# Problem while adding cgi.img

**URL:** <https://www.ruby-forum.com/t/problem-while-adding-cgi-img/172795>\
**Category:** Ruby\
**Created:** [July 28, 2009, 9:44am UTC](https://www.ruby-forum.com/t/problem-while-adding-cgi-img/172795 "2009-07-28T09:44:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![asaf1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@asaf1234](https://www.ruby-forum.com/u/asaf1234)\
**Post date:** [July 28, 2009, 9:44am UTC](https://www.ruby-forum.com/t/problem-while-adding-cgi-img/172795/1 "2009-07-28T09:44:40Z")

</div>

Hi,

I tried to insert an img file to my cgi script, but I had some problems.  
when i run the tmp.rb file that I create on the server, I can’t see this  
img. when I trying to run the generated html (using this script) on a  
front-page or even on a regular browser I can see that the format that I  
used is ok and I an see the image exactly where I placed it.  
Can you please help me understand what is the problem using the img on  
the server, and how to solve it, its realy importent …

Thanks,  
Asaf

---

<div class="post-metadata">

**Author:** ![asaf1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@asaf1234](https://www.ruby-forum.com/u/asaf1234)\
**Post date:** [July 28, 2009, 10:28am UTC](https://www.ruby-forum.com/t/problem-while-adding-cgi-img/172795/2 "2009-07-28T10:28:27Z")

</div>

Asaf Dasa wrote:

> Hi,
> 
> I tried to insert an img file to my cgi script, but I had some problems.  
> when i run the tmp.rb file that I create on the server, I can’t see this  
> img. when I trying to run the generated html (using this script) on a  
> front-page or even on a regular browser I can see that the format that I  
> used is ok and I an see the image exactly where I placed it.  
> Can you please help me understand what is the problem using the img on  
> the server, and how to solve it, its realy importent …
> 
> Thanks,  
> Asaf

In what directory is your image? And what path do you use for the image  
in your ruby program?

---

<div class="post-metadata">

**Author:** ![asaf1234](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/aeb1de/32.png) [@asaf1234](https://www.ruby-forum.com/u/asaf1234)\
**Post date:** [July 28, 2009, 12:08pm UTC](https://www.ruby-forum.com/t/problem-while-adding-cgi-img/172795/3 "2009-07-28T12:08:33Z")

</div>

7stud – wrote:

> Asaf Dasa wrote:
> 
> > Hi,
> > 
> > I tried to insert an img file to my cgi script, but I had some problems.  
> > when i run the tmp.rb file that I create on the server, I can’t see this  
> > img. when I trying to run the generated html (using this script) on a  
> > front-page or even on a regular browser I can see that the format that I  
> > used is ok and I an see the image exactly where I placed it.  
> > Can you please help me understand what is the problem using the img on  
> > the server, and how to solve it, its realy importent …
> > 
> > Thanks,  
> > Asaf
> 
> In what directory is your image? And what path do you use for the image  
> in your ruby program?

the img is in the directory where tmp.rb is and I use the following code  
:

…  
cgi.img(“border” =\> “0”,“src” =\> “icon.jpg”,“alt” =\> “my icon”, “type”  
=\> “JPEG Image”, “width” =\> “600”, “height” =\> “200”)  
…
