in reply to Display an image with a CGI program?

The image file is in the cgi-bin directory.

Some servers are treat all files in the cgi-bin as scripts. Your .gif isn't a script, so the web server returns an error. Try moving it to a different directory.

If that doesn't fix it, tell us what HTTP error the server returned. That would be in the web server's access log.

  • Comment on Re: Display an image with a CGI program?

Replies are listed 'Best First'.
Re^2: Display an image with a CGI program?
by Anonymous Monk on May 27, 2009 at 07:03 UTC
    Hi.

    Thanks for the help!

    I moved the image file to the parent directory of both 'htdocs' and 'cgi-bin' then referenced it with '../cgi-bin/pixel.gif' and it worked.
      i am also facing a similar kind of problem. Below is my code.The image is not displayed. Can anyone help me out.
      use CGI qw(:all); print "Content-type:text/html\n\n"; print '<HTML> <head></head> <body> <h1> <img src="../images/example_product_loading.gif" alt="site_imag +e" width="800" height="200"> Test Imageeeee. </h1> </body> </HTML>';

        Did you check the webserver logs to see if there is any indication of a problem?

        Can you access the image directly, without your script?

        Read the thread you replied to, as it contains the answer to your question.