Problem in: img_options["size"] = img_size

hi guys,
I have show_image problem. I have the following code in
application_helper.rb in my rails project

def show_image(src,img_size)
img_options = { “src” => src.include?("/") ? src : “/images/#{src}” }
img_options[“src”] = img_options[“src”] + “.gif” unless
img_options[“border”] = “0”
img_options[“size”] = img_size
tag(“img”, img_options)

in my list.rhtml page I have the following code:

<%= show_image(“WORK2R-2_02.gif”,“16x16”) %>

But the second parameter is not working for me.

Is the problem in syntax?

plz make me clear.


you can’t use the ‘size’ option with the tag helper, only with the
image_tag helper. the “size” option will get translated to
height/width with image_tag

with the tag helper, you have to give all the correct attributes, so
use height/width options.

img_options[“height”], img_options[“width”] = img_size.split(“x”)