Skip to content

Instantly share code, notes, and snippets.

@danieljohnmorris
Created April 21, 2012 11:42
Show Gist options
  • Save danieljohnmorris/2436733 to your computer and use it in GitHub Desktop.
Save danieljohnmorris/2436733 to your computer and use it in GitHub Desktop.
gps carrierwave interrogation
Magick::Image.read(Image.with_file.find_by_import_file("DSC00014.JPG").file_url(:small_thumb))[0].get_exif_by_entry('GPSLongitude')[0][1]
Magick::Image.read(Image.with_file.find_by_import_file("DSC00014.JPG").file_url(:small_thumb))[0].get_exif_by_entry('Model')
pp Magick::Image.read(Image.with_file.find_by_import_file("DSC00014.JPG").file_url(:small_thumb))[0].get_exif_by_entry
@total_file_images = Image.with_file
@total_file_images_count = @total_file_images.count
@loop_counter = 0
puts @total_file_images.collect do |i|
o = false
if Magick::Image.read(i.file_url(:small_thumb))[0].get_exif_by_entry('GPSLongitude')[0][1] != nil
@loop_counter += 1
o = true
end
puts "#{@loop_counter}/#{@total_file_images_count}"
o
end.count
@danieljohnmorris
Copy link
Author

Optimisation options:

  • scan local files instead of remote thumb (needs full original path stored)
  • store exif in db and scan them after!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment