Re: Image::Magick and perl script STDOUT problem
- From: ko <kuujinbo@xxxxxxxxxxx>
- Date: Thu, 21 Jul 2005 22:06:35 +0900
rbonin@xxxxxxxxx wrote:
The image magick method Write('gif:-') is supposed to write the binary file to STDOUT. I tried adding "binmode STDOUT" before the $image->Write command but that did not help. The STDOUT from $image->Write('gif:-'); is not making it's way to the browser, the browser is displaying a broken image. Looking at the raw response, I see the correct header, just no data being sent.
Can I capture the STDOUT into a variable, and use a binary write to the browser? I don't want to write the image to the hard drive.
<% @LANGUAGE="PerlScript" %> <% use Image::Magick;
my $image = Image::Magick->new; $image->Read('W:\\in.gif');
$Response->{ContentType} = "image/GIF"; $image->Write('gif:-');
undef $image;
%>
Thanks Robin
You're looking for the BinaryWrite() method:
use strict; use warnings; use Image::Magick; use Win32::OLE::Variant; our ($Response, $Request);
my $f = 'FILE_PATH'; my $i = Image::Magick->new; $i->Read($f); # never understood IM return values ... or die $!; my $blob = ( $i->ImageToBlob() )[0];
$Response->{contenttype} = 'image/gif';
$Response->BinaryWrite( Win32::OLE::Variant->new(VT_UI1, $blob) );In the ActiveState documentation:
Windows Scripting => Active Server Pages => To Read And Display Binary Large Objects (ADO and ASP)
HTH - keith .
- Follow-Ups:
- Re: Image::Magick and perl script STDOUT problem
- From: rbonin
- Re: Image::Magick and perl script STDOUT problem
- References:
- Image::Magick and perl script STDOUT problem
- From: rbonin
- Image::Magick and perl script STDOUT problem
- Prev by Date: Re: csv parse bug...
- Next by Date: Convert Integer value to IP Address
- Previous by thread: Re: Image::Magick and perl script STDOUT problem
- Next by thread: Re: Image::Magick and perl script STDOUT problem
- Index(es):
Relevant Pages
|