page_attachments extension's image sizes?

4 views
Skip to first unread message

Simon Rönnqvist

unread,
Nov 3, 2010, 6:03:00 AM11/3/10
to rad...@radiantcms.org
  Hi!

I'm using an old Radiant 0.7.1 installation with the page_attachments extension in use.

In the Radiant admin interface thumbnails seem to be working, I get small icons for attached images there. But on the actual web pages I don't get resized images showing up, I might be doing something wrong... but the page_attachments extension doesn't seem to be all that well documented, so I turn to you. :)

I added PAGE_ATTACHMENT_SIZES = {:thumb => '120x120>', :normal => '640x480>'} at the end of my environment.rb and restarted the app, I used this kind of Radius code:

<r:children:each order="desc">
<div class="entry">
  <h2><r:title /></h2>
  <r:attachment:each extensions="png|jpg"><r:attachment:link><r:attachment:image:thumb /></r:attachment:link><br /></r:attachment:each>
  <r:content />
</div>
</r:children:each>

What I get is a full sized image. Any ideas of where things might have gone wrong?

When I tested with just a simple <r:attachment:image:thumb name="image.png" /> again I got ‘name’ attribute required in the page.

  cheers, Simon

Jim Gay

unread,
Nov 3, 2010, 9:08:15 AM11/3/10
to radia...@googlegroups.com, rad...@radiantcms.org
2010/11/3 Simon Rönnqvist <si...@iki.fi>:

I don't see where a "thumb" radius tag is defined in the source. Why
did you expect that tag to work? We'll need to correct the docs if
that's where you got it.
Looking at the 0.6.9 tagged code (and it's still this way in the
latest version) I see the description of the image tag:

https://github.com/radiant/radiant-page-attachments-extension/blob/0.6.9/app/models/page_attachment_tags.rb#L117

Have you tried:
<r:attachment:image name="file.jpg" size="thumb"/>

--
Jim Gay
Saturn Flyer LLC
http://www.saturnflyer.com
571-403-0338

Simon Rönnqvist

unread,
Nov 3, 2010, 10:11:44 AM11/3/10
to rad...@radiantcms.org
Nevermind I figured it'd go into the size-attribute. It suddenly struck me that Rails symbols don't have anything to do with the : in Radius... I guess. And I could suddenly remember seeing the size-attribute somewhere. :)

  cheers, Simon

Simon Rönnqvist

unread,
Nov 4, 2010, 7:17:37 PM11/4/10
to radia...@googlegroups.com

Hi!

Sorry missed your post. As you might have seen from something I posted shortly after your post (even though I missed it) I didn't get that from any documentation at all, in fact I was unable to find anything about it... but later on I remembered reading somewhere that one should use the size-attribute, as you pointed out. (But it sucks a little bit that the size-attributes also shows up in the actual output... and a validator would choke on that.)

Anyways... now I got it working, but I only get it working for size="icon" but not size="thumb"... this also applies to newly added images. For size="thumb" it links the image correctly, but the thumb-image isn't simply generated. However my PAGE_ATTACHMENT_SIZES = {:thumb => '120x120>', :normal => '640x480>'} at the end of environment.rb seems to be recognized as new normal images (without a size attribute) are now limited to the specified size.

cheers, Simon

Simon Rönnqvist

unread,
Nov 4, 2010, 8:06:34 PM11/4/10
to radia...@googlegroups.com

My assumption that it did recognize 'normal' size was wrong, the images in question just happened to be small enough. :) So I moved PAGE_ATTACHMENT_SIZES = {:thumb => '120x120>', :normal => '640x480>'} to the beginning of environment.rb instead and voila, it works! :)

cheers, Simon

Reply all
Reply to author
Forward
0 new messages