# Problem in: img\_options\["size"\] = img\_size

**URL:** <https://www.ruby-forum.com/t/problem-in-img-options-size-img-size/103134>\
**Category:** Rails\
**Created:** [May 2, 2007, 6:17am UTC](https://www.ruby-forum.com/t/problem-in-img-options-size-img-size/103134 "2007-05-02T06:17:39Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sanjay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/58956e/32.png) [@sanjay](https://www.ruby-forum.com/u/sanjay)\
**Post date:** [May 2, 2007, 6:17am UTC](https://www.ruby-forum.com/t/problem-in-img-options-size-img-size/103134/1 "2007-05-02T06:17:39Z")

</div>

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[“src”].include?(".")  
img\_options[“border”] = “0”  
img\_options[“size”] = img\_size  
tag(“img”, img\_options)  
end  
end

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.

sanjay

---

<div class="post-metadata">

**Author:** ![sanjay](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/58956e/32.png) [@sanjay](https://www.ruby-forum.com/u/sanjay)\
**Post date:** [May 2, 2007, 1:47pm UTC](https://www.ruby-forum.com/t/problem-in-img-options-size-img-size/103134/2 "2007-05-02T13:47:07Z")

</div>

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”)
