导轨>炼油厂CMS>显示图像缩略图
我已在我的炼油厂应用程序中添加了一个带有图像字段的自定义引擎。这一切都链接得很好,在管理区域中我可以向其中添加图像等。
但是,我有一个关于将所述图像添加到视图中的问题。目前,我在视图中有以下代码:
<a href="<%= project.picture.url %>"><img src="<%= project.picture.url %>" alt="Image description" /></a>
这可以很好地显示我的图像(尽管它可能不是最好的方法 - 欢迎提示),但我想知道如何访问该图像的缩略图。我注意到在炼油厂的其他领域,您可以在图像对象上调用缩略图方法。
<%= image_fu image, ::Image.user_image_sizes[thumbnail.to_sym],
:class => "brown_border",
:class => "current_picked_image" %>
请有人帮我完成如何实现这一目标的步骤。上面的代码片段来自 image_picker 页面代码。作为 Rails 的新手,我不确定如何在自己的页面中实现这一目标。
预先感谢您的帮助!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 image_fu:
With image_fu: