Season's greets, Eric & fellow Perlites:

Yes, chances are, if you're getting *something* but not an image, you're
either sending the wrong headers to the browser OR you're sending the right
headers and then getting a compilation error...Or both.  On a windows
machine, there's also the possibility that you're not using Binary mode on
your image file handles (but since you're doing it in linux for the time
being, that's one problem we won't have to worry about)

What I usually do when this happens, is right click (from NS6+ or Mozilla)
and do a "view source" on the image itself... in the "source" you'll see the
actual output of your script which will contain the error, if there is one.

Another good test, which I'm sure you've already done, is to makes sure that
when you type
%> perl showphoto.pl
you're script actually compiles, and runs and then spews a bunch of binary
data to your terminal...(after printing Content-type: image/jpg\n\n (or
whatever))
I'd recommend this over redirecting you're output into a file because it
should tell you immediately if you're having compilation errors.

The other thing to do is make sure you're "dying" where appropriate... I
don't remember your original script but make sure you have things like:

open(IMAGE,"myPic.jpg") or die("Couldn't open pic! $!");

(the $! will tell you what actual error occured... this way, if you've got
the wrong path or insufficient priviladges, etc. you'll find out the easy
way...

HTH & good luck!

-Peter




-----Original Message-----
From: zentara [mailto:[EMAIL PROTECTED]]
Sent: Sunday, December 22, 2002 4:54 AM
To: [EMAIL PROTECTED]
Subject: Re: broadcast photo on other site not by up load


On Sat, 21 Dec 2002 14:07:03 -0700, [EMAIL PROTECTED] (Eric Lin)
wrote:

>   Now I am in linux again,
>I did /usr/bin/perl  /usr/lib/cgi-bin/showphoto.pl > mytestout.jpg
>then at netscape 7 's url type /home/fsshl/mytestout.jpg
>
>it showed
>---------------------------
>The image "file:///home/fsshl/mytestout.jpg" cannot be displayed, 
>because it contains errors

Make sure your showphoto.pl script is not outputting an html header.
Can you look at mytestout.jpg with somethong else like "xv".
Look at mytestout.jpg with a hex editor and see what the first few lines
are. Are they a valid jpeg header? Compare it to other known good jpegs
you have.
Your showphoto.pl script should be able to read in a image and then
print it out without corrupting it. Post your showphoto.pl that you are
using.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to