grao5 has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
In order to create and image based web counter using Perl cgi on Windows 98 I am just trying to read an image into an html from a perl cgi script. But it does not work for some reason. I have 3 files in my source directory. mycounter.html, mycounter.cgi and counter.jpg Inside my html file mycounter.html I try to read image from the perl cgi script using the line.
<img src = mycounter.cgi>
where mycounter.cgi is my perl cgi program with the following contents.
#!C:\Progra~1\Perl\bin\perl use CGI; $co=new CGI; $size = stat("counter.jpg")[7]; open (FILEHANDLE,"<counter.jpg"); read FILEHANDLE,$imagedata,$size; close FILEHANDLE print $co->header(-type=>'image/jpeg'), "Below is my counter image file", $imagedata;
Then I try to open mycounter.html from the browser. But all I see on the browser is
the string "Below is my counter image file" which it reads from the perl script but then there is no image at all (just a blank image).
Why is the html unable to read the image sent from the cgi script.
Once again I am running this on Windows 98 OS.
Your help will be greatly apprecited
thanks
grao5
(grao5@hotmail.com)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Error reading image from perl cgi script into HTML
by PodMaster (Abbot) on Oct 13, 2002 at 04:29 UTC | |
|
Re: Error reading image from perl cgi script into HTML
by fsn (Friar) on Oct 13, 2002 at 12:32 UTC | |
by Anonymous Monk on Oct 13, 2002 at 23:02 UTC | |
by true (Pilgrim) on Oct 14, 2002 at 02:08 UTC | |
|
Re: Error reading image from perl cgi script into HTML
by BUU (Prior) on Oct 13, 2002 at 16:35 UTC |