You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by lemur08 <ng...@gmail.com> on 2008/06/30 17:37:09 UTC

mod_perl and perlMagick Write

Hello all, I'm a newbie with mod_perl so please be patient with me.

I'm working no a very simple image manipulation script using perlMagick. The
script reads an image from file, resizes it, and then serves it up to the
browser using the perlMagick function Write, like this: $pic->Write("jpg:-")

I've tested this script under Apache 2.0 and perl 5.8.8 and it works fine.
But as soon as I run it under mod_perl (using ModPerl::Registry as
perlHandler) the same code will no longer yield the image to the browser.
The header content type is being set correctly to "image/jpg" but after that
the document is 0k.

Are there specific problems of using perlMagick and mod_perl? Or is this an
issue with the way I am attempting to write the image to the browser via
mod_perl? I have tried flushing the buffer in the usual mod_perl way, but to
no avail.

Thanks for your help.

-- 
View this message in context: http://www.nabble.com/mod_perl-and-perlMagick-Write-tp18198248p18198248.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: mod_perl and perlMagick Write

Posted by lemur08 <ng...@gmail.com>.
Thanks, I've received a reply with the solution. I'm now using the
ImageToBlob function and it works fine! Thanks for the responses.
-- 
View this message in context: http://www.nabble.com/mod_perl-and-perlMagick-Write-tp18198248p18198541.html
Sent from the mod_perl - General mailing list archive at Nabble.com.


Re: mod_perl and perlMagick Write

Posted by André Warnier <aw...@ice-sa.com>.
lemur08 wrote:
> Hello all, I'm a newbie with mod_perl so please be patient with me.

You wouldn't believe how patient the people on this list are :-)

Two tips for debugging your kind of present problem, and many others 
with the web in the future :

1) as a browser use Firefox, with the LiveHttpHeaders add-on.
This add-on will show you, for any request to a web server, which HTTP 
headers Firefox is sending out, and with which HTTP headers the response 
comes back to the browser.

2) alternatively, consult your perl on-line documentation for the 
"lwp-request" program.  If you have perl installed on your workstation, 
this program is installed also.  Depending on the options you give, it 
will allow you to send requests to a web server from the command-line, 
and show you details about the response (headers or content or both).
Example :
suppose the URL you use to get the image from your server is :
http://www.myserver.com/cgi-bin/getimage.pl?image=number1

then in a command window, enter (in 1 line) :
lwp-request -m GET -Sed 
"http://www.myserver.com/cgi-bin/getimage.pl?image=number1"

and it will show you which HTTP headers come back with the server 
response.  With the options above, it will not try to display the 
content (the image), which is better in this case.
Try it with www.google.com e.g.


André