I am using paperclip to upload and display images in my Rails application.
<% @submission.images.each do | image | %>
<%= image_tag(image.data.url(:thumb), :alt => '') %>
<% end unless @submission.images.first.new_record? rescue nil %&开发者_C百科gt;
The code above displays the thumbnails of the images.
I would like to make the thumbnail a link so that when user clicks on it, a popup is displayed showing the original image.
I tried including a link to the thumbnail as follows:
<%=link_to image_tag(image.data.url(:thumb)), :popup=>['original_image', 'height=700,width=900'] %>
But i have no idea where to put the contents of the popup as image_tag(image.data.url(:original))
Thanks a lot for any suggestion provided.
What you have is the thumbnail as a link, but you're missing what you're linking to. Try the following:
<%=link_to image_tag(image.data.url(:thumb)), image.data.url(:original), :popup=>['original_image', 'height=700,width=900'] %>
精彩评论