Skip to content
Browse files

Remove size attr from img tag

  • Loading branch information...
1 parent 53872b0 commit ffbe4c435c45a67c7a4709e0641edb4d758bc0af @ccbcreg ccbcreg committed with johnmuhl
Showing with 1 addition and 1 deletion.
  1. +1 −1 app/models/page_attachment_tags.rb
2 app/models/page_attachment_tags.rb
@@ -128,7 +128,7 @@ class TagError < StandardError; end
raise TagError, "'name' attribute required" unless name = tag.attr.delete('name') or tag.locals.attachment
page =
attachment = tag.locals.attachment || page.attachment(name)
- size = tag.attr['size'] || nil
+ size = tag.attr.delete('size') || nil
raise TagError, "attachment is not an image." unless attachment.content_type.strip =~ /^image\//
filename = attachment.public_filename(size) rescue ""
attributes = tag.attr.inject([]){ |a,(k,v)| a << %{#{k}="#{v}"} }.join(" ").strip

3 comments on commit ffbe4c4


This breaks if you have attachment:each containing attachment:image with size attribute. Only your first image in the loop will have the size attribute.


Just tested with a loop like so:

<r:attachment:image size="icon"/>

And the output was:

<img src="/page_attachments/website//0002/2386/colo_icon.gif"/>
<img src="/page_attachments/website//0002/2387/colo1_icon.gif"/>
<img src="/page_attachments/website//0002/2388/colo2_icon.gif"/>

I think that is proper behavior. What version of Radiant are you using?


Fair enough. Upgrading to Radiant 0.9.1 and the snippet which was using the loop behaved as I described. Could be due to changes in our fork.

Please sign in to comment.
Something went wrong with that request. Please try again.