sir_com has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I am using Apache 2.2.4 in Windows. I have a simple cgi script where I am just printing one line and trying to display a image. I tried a lot but my image us not getting displayed. I don't see any error in error.log file too. Please help me. Below is my code:

#!C:\perl\bin\perl.exe use strict; use CGI; use CGI qw(:standard); use CGI::Carp qw(warningsToBrowser fatalsToBrowser); my $query = new CGI; print $query->header( "text/html" ); print <<END_HERE; <html> <body> <h3>How is the car</h3> <img src="C:\\Program Files\\Apache Software Foundation\\Apache2.2\\cg +i-bin\\images\\car.bmp"></img> </body> </html> END_HERE; #scripts ends

When I try the same as .html files the image gets loaded properly. Am I missing some settings. Please help me.

Thanks, sir_com

Replies are listed 'Best First'.
Re: image not getting displayed
by ikegami (Patriarch) on Sep 09, 2009 at 19:44 UTC
    • That's invalid HTML. The IMG element cannot have a closing tag.
    • That's invalid HTML. The ALT attribute is required for IMG elements.
    • "C:\..." as an URL doesn't mean what you think it means.
    • Even if "C:\..." was incorrectly handled as a file path, it would refer to the client's C:, not the server's. Aside from the fact that won't do what you want, it might be disallowed for security reasons.
    • Finally, .bmp? What an awful format! It's huge and not well supported.
      Hi ikegami, Thanks a lot for the response. I have found my mistake and corrected it. Thanks again. sir_com