Created
April 28, 2016 07:54
-
-
Save rafapolo/532dee891e4ef6422e12a0a0fb1d3546 to your computer and use it in GitHub Desktop.
read exif metadata from uploaded pics on the browser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
set :port, 8080 | |
set :bind, '0.0.0.0' | |
get "/" do | |
erb :index | |
end | |
get '/get_exif' do | |
"Upload an image." | |
end | |
post '/get_exif' do | |
@filename = params[:file][:filename] | |
file = params[:file][:tempfile] | |
path = "./tmp/#{@filename}" | |
File.open(path, 'wb') do |f| | |
f.write(file.read) | |
end | |
@exif = `exiftool #{path}` | |
`rm #{path}` | |
erb :exif | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment