-
Cannot see image
I am using the following simple cgi script to generate a html page but I cannot see the image. I have a images directory in my cgi-bin folder and a file called arrow.gif but it doesn't show up on the page. Can someone tell me if the cgi looks ok ?
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndHTML
<html><head><title>Test!</title></head>
<body>
<table border=1>
<tr>
<td><img src=\"images/arrow.gif\"></td>
</tr>
</table>
</body>
</html>
EndHTML
-
><img src=\"images/arrow.gif\">
Shouldn't that be <img src="/images/arrow.gif">?
-
Check the source of the generated HTML page. I'm not sure if you need to escape the quotes in a here document.
-
It seems to me that the bold \ should be / instead.
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndHTML
<html><head><title>Test!</title></head>
<body>
<table border=1>
<tr>
<td><img src=\"images/arrow.gif\"></td>
</tr>
</table>
</body>
</html>
EndHTML
If they should be there at all? :)
-
i don't think you even need them
-
Code:
#!/usr/bin/perl
print "Content-type:text/html\n\n";
print <<EndHTML
<html><head><title>Test!</title></head>
<body>
<table border=1>
<tr>
<td><img src="/cgi-bin/images/arrow.gif"></td>
</tr>
</table>
</body>
</html>
EndHTML
you dont need to escape your qoutes you simplty need to put the correct path to you gif.
-
by the way if i where you i'd keep my images in the html directory!
If you created the images directory in the html directory eg. html/images/arrow.gif
you would access it like this /images/arrow.gif
:cool:
-
That was it!
I had the images in the cgi-bin directory, I didn't realise this wasn't allowed. It all seems to work fine now.
Many thanks.