Last active
June 9, 2017 19:36
-
-
Save uhlenbrock/e21b2fd1edb0a9b9a2f7767a5f90259b to your computer and use it in GitHub Desktop.
Read EXIF data with a Dragonfly Analyzer
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 'dragonfly' | |
require 'exif_analyser' | |
Dragonfly.app.configure do | |
plugin ExifAnalyser.new | |
end |
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
class ExifAnalyser | |
def call(app, opts = {}) | |
# OS X: `brew install exiftool` | |
# Ubuntu: `apt-get libimage-exiftool-perl` | |
app.env[:exiftool_command] = opts[:exiftool_command] || 'exiftool' | |
app.define :exif do |*_args| | |
begin | |
shell_eval { |path| "#{app.env[:exiftool_command]} -j #{path}" } | |
rescue Dragonfly::Shell::CommandFailed => e | |
Dragonfly.debug(e) | |
nil | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment