Project

General

Profile

« Previous | Next » 

Revision 37fbb0a9

Added by Marc Dequènes over 14 years ago

  • ID 37fbb0a920b072cdb7bf36317742097d5dc215b3

[fix] handle image/thumbnail errors better in helpers

View differences:

app/helpers/application_helper.rb
def display_thumbnail(img, thumb_name = nil)
return if img.nil?
unless File.exists? img.full_filename(thumb_name)
img.saved_attachment = true
img.after_process_attachment
if not img.exists?
return "<span class='error'>" + _("Missing Image !") + "</span>"
end
thumb = img.thumbnail(thumb_name)
if thumb.nil?
"<span class='error'>" + _("Missing Thumbnail !") + "</span>"
else
image_tag(img.public_filename(thumb_name))
end
image_tag(img.public_filename(thumb_name))
end
# MyCyma-specific, should be removed or adapted for Verard
......
frame_margin = params.has_key?(:frame_margin) ? params[:frame_margin] : 3
classes = params.has_key?(:classes) ? params[:classes].to_a : []
style = ""
thumb = image.thumbnail(size)
frame_width = thumb.width + image_padding * 2
style = "width: #{frame_width}px;"
#style += " border: 1px solid red;"
unless thumb.nil?
frame_width = thumb.width + image_padding * 2
style += "width: #{frame_width}px;"
end
case frame_type
when :classic
style += " margin: #{frame_margin}px;"

Also available in: Unified diff