问题
I just updated the dimensions of an image thumbnail, and have been working on updating 28,000 photo objects. Unfortunately, this kind of process takes many processes over a long time to accomplish. In this process, some get rejected, and some processes get canceled.
Is there a way to identify whether an image thumbnail has the current dimensions or not?
回答1:
I'm unsure I understood your question but you can get the width and height of any file using Paperclip.
geo = Paperclip::Geometry.from_file(user.picture.path(:thumbnail))
geo.width
geo.height
You could get the dimensions of any style automatically:
user.picture.styles[:thumbnail].geometry # => "125x125!"
You even have some useful methods like:
geo.horizontal?
geo.vertical?
来源:https://stackoverflow.com/questions/6806801/can-you-identify-the-current-dimensions-of-an-image-with-paperclip