Forum: Ruby on Rails RE:How do I wrap a <%= link to %> around an image?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Bharat A. (Guest)
on 2006-06-06 11:22
(Received via mailing list)
>  <%= link_to(image_tag("../../images/photos/photo.photogroup/TN_
> <img src="../../images/photos/<%= photo.photogroup %>/TN_<%=
> photo.photogroup %><%= photo.filenumber %>.jpg" alt="<%=
> photo.description %>">
>
> Which works well, except that the best I can have with this is a text
> link NEXT to an image, when what I really want is the image to BE the
> link.


Well from the code sample it looks like u need some string formatting.
Try doing

 <%= link_to(image_tag("../../images/photos/#{photo.photogroup}/TN_
#{photo.photogroup) #{photo.filenumber}.jpg"), "http://www.example.com")
%>

This should see u through.

Bharat
This topic is locked and can not be replied to.