Hi,
I am trying to do a very simple thing of reading an image file (jpeg) into an HTML page from a perl cgi script. But for some reason when I click the html file I get a blank image. Why? I am running on Windows 98 OS. If someone could try this out practically and then give me details as to what is wrong in my program, I would really appreciate.
I have the following 3 files in my source directory from where I am running.
(1) myprogram.html
(2) myprogram.cgi
(3) picture.jpg
Here are the contents of my html file "myprogram.html"
<HTML> <head> <title> Test page </title> </head> <BODY> <IMG SRC = "myprogram.cgi"> </BODY> </HTML>
Following are the contents of my perl cgi program "myprogram.cgi"
#!C:\Progra~1\Perl\bin\perl use CGI; $co=new CGI; BINMODE IMAGEHANDLE1; open(IMAGEHANDLE1,"<picture.jpg") or die "filenot found"; $size1=(stat("picture.jpg"))[7]; read IMAGEHANDLE1,$data1,$size1; close IMAGEHANDLE1 ; print $co->header(-type=>'image/jpeg'), $data1;
thanks
grao5 (grao5@hotmail.com)
In reply to Problem reading image from perl cgi script by grao5
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |