how to make a picture a linked picture

Ghazal Mir wrote:

hi i want to get a picture and a linke as inputs from user and then when user clicked on that picture it goes to that link related to the picture do anyone know how? thanks in advance

<%= link_to image_tag( 'img1.jpg' ), :action => 'action_to_perform' %>

Shandy Nantz wrote:

<%= link_to image_tag( 'img1.jpg' ), :action => 'action_to_perform' %>

Or, if you want to use a link_to_remote:

<%= link_to_remote image_tag( 'img1.jpg' ), :url => {   :action => 'action_to_perform'}, :update => 'update_div' %>

I use similar code a lot as a user interface where you don't want another page to load. For example, if I needed to turn a value on or off I would do something like:

<%= link_to_remote image_tag( @user.active ? 'chexk.jpg' : 'ex.jpg' ), :url => {:action => 'action_to_perform', :id => @user.id}, :update => 'update_div' %>