Syntax of link_to_image

I have an image that I’m needing to display and do a link to another in
a popup window. I found the link_to_image helper, but I’m having a
problem with it. I need to control the size of the first displayed image
(the anchor). It needs to have
width=“100%” height=“100%” added to the image tag in order to keep
the anchor image from displaying way too large. The code I’m using right
now is

<%= link_to_image ( @elevated, @elevated, :popup => [‘New Window’] )
%>

What should I add to get width=“100%” height=“100%” included in the
source img tag?

Thanks in advance
—Michael

Michael S. wrote:

I have an image that I’m needing to display and do a link to another in
a popup window. I found the link_to_image helper, but I’m having a
problem with it. I need to control the size of the first displayed image
(the anchor). It needs to have
width=“100%” height=“100%” added to the image tag in order to keep
the anchor image from displaying way too large. The code I’m using right
now is

<%= link_to_image ( @elevated, @elevated, :popup => [‘New Window’] )
%>

What should I add to get width=“100%” height=“100%” included in the
source img tag?

Thanks in advance
—Michael

I think link_to_image is deprecated in favor of a link_to() with an
image_tag() as the first parm, like the following:

<%= link_to(image_tag(‘button.gif’, :width => “100%”, :height =>
“100%”), {:controller => ‘controller’, :action => ‘action’})

However - you should really control your presentation elements with CSS
styling instead of the width= and height= attributes on the img tag.

c.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs