You can clone with
HTTPS or Subversion.
Is it possible somehow to retrieve the dimensions of a thumbnail generated by Paperclip?
For example it would be useful to have something like this-> @product.image.width; @product.image.height.
I don't know about within Paperclip, but outside Paperclip you could try Dimensions.
# @note Do this after resize operations to account for auto-orientation.
tempfile = upload.queued_for_write[:original]
geometry = Paperclip::Geometry.from_file(tempfile)
self.dimensions = [geometry.width.to_i, geometry.height.to_i]
You'll be able to do @product.image.geometry.width and @product.image.geometry.height in Paperclip 3.0.1.
Don't these calls download the file in order to run the geometry calculations? If so, this is expensive and impractical, which is why I personally do it once on a before_save.
Yep, you can. I'd love to take a pull request for a magic attachment_width/attachment_height attribute too, but this is a cheap (easy to implement) solution when your attachment is already saved.
I wouldn't suggest anyone who's using s3 use those methods.
Yeah, and there's no way to get that attachment metadata without fetching the file down anyway after you've saved it. :)
That code is broken anyway, so I'm reverting it.
I think i am going to merge #835 into 3.1, so closing this.