如何在Rails中检索图像的EXIF信息 [英] How to retrieve EXIF information of an image in Rails
本文介绍了如何在Rails中检索图像的EXIF信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用Rails回形针在页面中显示图像.我想知道如何检索图像的EXIF信息(例如尺寸,相机型号,高度,宽度等).有人可以帮我吗?
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???
谢谢!!!
推荐答案
您是否尝试了 exifr gem?从文档中
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
这篇关于如何在Rails中检索图像的EXIF信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文