tan*_*nya 3 ruby-on-rails paperclip
我正在使用paperclip在我的Rails应用程序中上传和显示图像.
<% @submission.images.each do | image | %>
<%= image_tag(image.data.url(:thumb), :alt => '') %>
<% end unless @submission.images.first.new_record? rescue nil %>
Run Code Online (Sandbox Code Playgroud)
上面的代码显示图像的缩略图.
我想将缩略图设为链接,以便当用户点击它时,会显示一个弹出窗口,显示原始图像.
我尝试了包含缩略图的链接,如下所示:
<%=link_to image_tag(image.data.url(:thumb)), :popup=>['original_image', 'height=700,width=900'] %>
Run Code Online (Sandbox Code Playgroud)
但我不知道将弹出窗口的内容放在哪里 image_tag(image.data.url(:original))
非常感谢您提供的任何建议.
Jef*_*tte 11
你所拥有的是缩略图作为链接,但你错过了你要链接的内容.请尝试以下方法:
<%=link_to image_tag(image.data.url(:thumb)), image.data.url(:original), :popup=>['original_image', 'height=700,width=900'] %>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5771 次 |
| 最近记录: |