ruby-on-railsrubypaperclipexif

How to retrieve EXIF information of an image in Rails


I am using Rails paperclip for displaying the images in my page. I want to know how to retrieve EXIF information of an image(like dimensions, camera model,height,width., etc).Can any one help me out???

Thanks!!!


Solution

  • Did you give exifr gem a try? From the documentation

    EXIFR::JPEG.new('IMG_6841.JPG').width               # => 2272
    EXIFR::JPEG.new('IMG_6841.JPG').height              # => 1704
    EXIFR::JPEG.new('IMG_6841.JPG').exif?               # => true
    EXIFR::JPEG.new('IMG_6841.JPG').model               # => "Canon PowerShot G3"
    EXIFR::JPEG.new('IMG_6841.JPG').date_time           # => Fri Feb 09 16:48:54 +0100 2007
    EXIFR::JPEG.new('IMG_6841.JPG').exposure_time.to_s  # => "1/15"
    EXIFR::JPEG.new('IMG_6841.JPG').f_number.to_f       # => 2.0