LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   using CGI for IMAGES need help (https://www.linuxquestions.org/questions/programming-9/using-cgi-for-images-need-help-193642/)

Xris718 06-15-2004 01:00 AM

using CGI for IMAGES need help
 
Hi all

I have been searching the net and cant find any place on how to use cgi to display .gif or .jpeg files. Here is what my script looks like but image doesnt seem to display on the browser .... what am i doing wrong?

#!/usr/bin/perl
$|=1; ## clears the buffer

use CGI ':standard';
print "Content-type: text/html\n\n";

print "<html>\n";
print "<body bgcolor=\"black\" text=\"white\" link=\"#FF0000\" vlink=\"#800000\">\n\n";

print "<pre>\n";
print "<font color=orange>POWERED BY LINUX </font>
<img src=penguin.gif>";
print "</pre>\n";
print "</body>\n";
print "</html>\n";

david_ross 06-15-2004 01:53 PM

It is an html problem not CGI or perl. Try specifying the full web path to "penguin.gif".

Xris718 06-15-2004 04:54 PM

actually i tried providing full path but it still didnt seem to work. I changed permissions for full access of that picture and the picture is in same directory as the script but its still doesnt seem to work.

The_Nerd 06-16-2004 12:44 PM

Well, maybe you should try:
Code:

printf("<IMG SRC=\"penguin.gif\">");
Don't know if that will help or not. Hey, if you are trying out CGI in C/C++, check out my library.

http://www.restorides.com/~nerd/libc...cgi-1.1.tar.gz

It is really easy to use and it really helps allot when working with CGI. Hope that helps.

Xris718 06-17-2004 12:53 AM

Actually all im using is HTML and CGI. Dont know much about C/C++. I just gont understand why its so hard or tricky to display a simple image using CGI. Trully boggles my mind. Any other ideas would be appreciated thanks.


All times are GMT -5. The time now is 08:25 AM.