开发者

Rails link_to open a larger image

My app showing thumbnails, but if I click the 开发者_StackOverflow中文版thumbail, its downloaded, not showed up. How its work? link_to image_tag('lorem'), image_tag('lorem_big')?

<% for photo in @article.attachments %>
  <%= link_to image_tag('dinamic/'+photo.id.to_s+'/'+'thumbs_'+photo.image_file_name), "#{request.env["HTTP_HOST"]}/public/images/dinamic/"+photo.id.to_s+"/"+"originals_"+photo.image_file_name, :class => 'single_image'%>
<% end %>


Have you tried different browsers?

Try to capture HTTP communication how your app server sets Content-Disposition header attribute.

If you cannot control your server, you can do minicontroller which will render one tag with that image :)


 <% for photo in @static.attachments %>
  <a id="single_image" href="<%=  image_path("dinamic/"+photo.id.to_s+"/"+"originals_"+photo.image_file_name) %>" > <%= image_tag('dinamic/'+photo.id.to_s+'/'+'thumbs_'+photo.image_file_name) %> </a>
<% end %>

Image_path solved this issue.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜