Project

General

Profile

« Previous | Next » 

Revision 4ef5bacc

Added by Marc Dequènes over 14 years ago

  • ID 4ef5bacc0c50575e64b8f6302e1a385043656441

[fix] ensure the default display size for a thumbnail (currently the full image) does not crash (closes #77)

View differences:

app/helpers/application_helper.rb
table.content [_("Updated at:"), obj.updated_at]
end
def display_thumbnail(img, thumb_name = nil)
def display_thumbnail(img, size_name = nil)
return if img.nil?
if not img.exists?
return "<span class='error'>" + _("Missing Image !") + "</span>"
end
thumb = img.thumbnail(thumb_name)
thumb = img.thumbnail(size_name)
if thumb.nil?
"<span class='error'>" + _("Missing Thumbnail !") + "</span>"
else
image_tag(img.public_filename(thumb_name))
image_tag(img.public_filename(size_name))
end
end
app/models/artwork_step_image.rb
attr_accessor :saved_attachment
def thumbnail(size)
return self if size.nil?
thumb = self.artwork_step_thumbnails.find_by_thumbnail(size.to_s)
if thumb.nil?
regen_thumbnail(size)
......
def regen_thumbnail(size_name)
return unless self.exists?
return if size_name.nil?
size = attachment_options[:thumbnails][size_name]
temp_file = create_temp_file

Also available in: Unified diff