You need to use binmode on both the input and output. Try this:

print "content-type:image/jpeg\n\n";
open (IMG,"<$filename");
binmode IMG;
binmode STDOUT;
my $size = -s "$filename";
read IMG,$data,$size || die"$!\n";
close IMG;
print "$data";



----- Original Message ----- 
From: "Chris" <[EMAIL PROTECTED]>
To: "perl-win32-users" <[email protected]>
Sent: Tuesday, April 19, 2005 6:47 AM
Subject: Output image via http


> I know I've seen the answer to this question in the past but I can't seem
to
> find it in the archives or Google. How can I output an image directly from
> Perl? I've read about possibly using binmode, but haven't found a working
> example.
>
>
> print "Content-type: image/jpeg\n\n";
>
> open (data_In,"<small.jpg");
>
> print <data_In>;
>
> close (data_In);
>
> _______________________________________________
> Perl-Win32-Users mailing list
> [email protected]
> To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
>

_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to