开发者

Rails Pictures sort date

开发者 https://www.devze.com 2023-04-12 20:40 出处:网络
In Exifr for rails (im using this fork https://github.com/picuous/exifr ) how do i sort out the pictures according to date

In Exifr for rails (im using this fork https://github.com/picuous/exifr ) how do i sort out the pictures according to date this is how to get the date

EXIFR::JPEG.new('IMG_6841.JP开发者_Go百科G').date_time           # => Fri Feb 09 16:48:54 +0100 2007

if im too vague let me know how to help


If you have all the pictures as a list just use Ruby's normal sort function (or sort!, if you want it in-place), so:

images.sort! { |img1, img2| img1.date_time <=> img2.date_time }
0

精彩评论

暂无评论...
验证码 换一张
取 消