attachment_fu Thumbnail Size
Posted on May 18th, 2007 by admin |
As I mentioned earlier, when working with attachment_fu and image science the width and height of thumbnails were not being set correctly. So here is a method that I use to make sure that the data is set.
def set_image_dimensions
if @image.width.blank? || @image.height.blank?
ImageScience.with_image("#{RAILS_ROOT}/public/" << @image.public_filename) do |img|
@image.height = img.height
@image.width = img.width
end
@image.update_attribute('height',@image.height)
@image.update_attribute('width',@image.width)
end
end
Is anyone doing it differently ? Has this been addressed ?
Comments welcome.
Hamza
Sorry, comments are closed for this article.