perl-embperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Torsten Luettgert <t.luettg...@cbxnet.de>
Subject Re: Delivering binary content from a Embperl application
Date Mon, 07 Aug 2006 15:24:42 GMT
On Mon, 2006-08-07 at 11:20 +0200, Frank Wesemann wrote:
> Torsten Luettgert schrieb:
> > Don't know about Embperl object, but for me, it "just works".
> > Here is some (reduced) code I use for delivering jpeg images:
> > 
> Interesting enough this doesn't work ( it outputs nothing! ):
> 
> > [-
> >    # some permission checking and obtaining $imgpath omitted
> >    if( -f $imgpath && $permission ) {
> >       $http_headers_out{'Content-Length'} = -s $imgpath;
> >       $http_headers_out{'Content-Type'} = 'image/jpeg';
> >       $http_headers_out{'Cache-Control'} = 'no-cache';
> >       $http_headers_out{'Pragma'} = 'no-cache';
> >       $http_headers_out{'Expires'} = '0';
> 	my $image = Image::Magick->new();
> 	$image->read($imgpath);
> 	$image->do_something_or_not();
> 	$image->write('-')
> >       exit 0;
> >    }
> > -]
> 
> and this is, err, strange behavior, I think.

Your $imgpath does contain a valid image?

If so, probably it doesn't work with printing to STDOUT,
like you did with $image->write('-');

Try putting the following before the write:

   tie *OUT, 'Embperl::Out';
   select(OUT);

Perhaps this helps.

Regards,
Torsten



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Mime
View raw message