LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-15-2004, 01:00 AM   #1
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Rep: Reputation: 30
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";
 
Old 06-15-2004, 01:53 PM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
It is an html problem not CGI or perl. Try specifying the full web path to "penguin.gif".
 
Old 06-15-2004, 04:54 PM   #3
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
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.
 
Old 06-16-2004, 12:44 PM   #4
The_Nerd
Member
 
Registered: Aug 2002
Distribution: Debian
Posts: 540

Rep: Reputation: 32
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.
 
Old 06-17-2004, 12:53 AM   #5
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Perl CGI:Can't locate CGI.pm supermyself Programming 13 09-10-2007 06:22 AM
Convert cd images to dvd images rcsuk Debian 2 07-11-2005 10:34 AM
CGI to work out side of cgi-bin? crashedspine Linux - Newbie 13 09-02-2004 08:49 PM
Displaying images in CGI scripts dodger-newbie Programming 9 03-22-2004 01:28 PM
http://www.burstnet.com/cgi-bin/ads/ad7954a.cgi/3980/RETURN-CODE rverlander LQ Suggestions & Feedback 1 06-07-2002 07:35 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration