开发者

Rails > Refinery CMS > Displaying an image thumbnail

开发者 https://www.devze.com 2023-03-28 03:21 出处:网络
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'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 i开发者_如何学编程mage 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!


With image_fu:

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

精彩评论

暂无评论...
验证码 换一张
取 消