Adam
Adam

Reputation: 2997

Rails > Refinery CMS > Displaying an image thumbnail

I've added a custom engine into my refinery app with an image field. It all links up great and in the admin areas I can add images to it, etc.

I have a question about adding said images to a view however. At the moment I have the following code in a view:

<a href="<%= project.picture.url %>"><img src="<%= project.picture.url %>" alt="Image description" /></a>

This displays my image nicely (although its probably not the best method - tips welcome) but I wanted to know how to access the thumbnail of that image. I noticed in others areas of refinery you can call a thumbnail method on an image object.

        <%= image_fu image, ::Image.user_image_sizes[thumbnail.to_sym],
                 :class => "brown_border",
                 :class => "current_picked_image" %>

Please could someone run me through the steps of how to achieve this. The code snippet above comes out of the image_picker page code. Being quite new to rails I'm not sure how I would achieve this in my own page.

Thanks in advance for your help!

Upvotes: 3

Views: 2427

Answers (1)

Agush
Agush

Reputation: 5116

With image_fu:

<%=link_to (image_fu project.picture, '160x104'), project.picture.url %>

Upvotes: 5

Related Questions