[Radiant] Attachment Image Sizes (was Re: Re: conditional display of image)

Ben Morrow morrow599 at yahoo.com
Fri May 9 11:00:17 CDT 2008


Dominic wrote:
> I think you used to have to change a couple of files.
> 
> In vendor/page_attachments/app/models/page_attachment.rb you can add
> more thumbnail sizes:
> :thumbnails => {:icon => '50x50>', :small => '160x160>', :medium =>
> '320x320>', :large => '640x640>'},
> 
> and also change the admin view to find the right icon thumbnail:
> <%= link_to image_tag(attachment.thumbnails.find(:first, :conditions
> => "thumbnail = 'icon'").public_filename, :class => "thumbnail") %>

Just had a chance to try this. It works brilliantly! In the page admin, 
I can simply drag the link from "Attachments" section and add the size I 
want to the end of the file name. Ex:

http://domain.com/image_small.jpg

Since I use Textile, I then add the image tag (!) and float it right 
like so:

!>http://domain.com/image_small.jpg!

Thanks for your help, Dominic!

-- 
Posted via http://www.ruby-forum.com/.


More information about the Radiant mailing list