paperclipped icon indicating copy to clipboard operation
paperclipped copied to clipboard

Asset#dimensions can break

Open kintner opened this issue 15 years ago • 0 comments

If you have an asset_updated_at column on your asset table this causes paperclip to append a timestamp on the url it generates. This breaks Asset#dimensions since it uses the thumbnail method to generate the path to the file. Instead you could use something like this

file = new_record? ? asset.instance_variable_get("@queued_for_write")[:original] : asset.path(size.to_sym)
geometry = Paperclip::Geometry.from_file(file)
[geometry.width.to_i, geometry.height.to_i]

kintner avatar Nov 03 '09 22:11 kintner