Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove size attr from img tag

  • Loading branch information...
commit ffbe4c435c45a67c7a4709e0641edb4d758bc0af 1 parent 53872b0
@ccbcreg ccbcreg authored johnmuhl committed
Showing with 1 addition and 1 deletion.
  1. +1 −1  app/models/page_attachment_tags.rb
View
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 = tag.locals.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

@snowblink

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.

@ccbcreg

Just tested with a loop like so:

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

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?

@snowblink

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.