Gossamer Forum
Home : General : Perl Programming :

Image::Magick and mod_perl won't work together

Quote Reply
Image::Magick and mod_perl won't work together
Hello,

I wrote a litle plugin for GLinks to serve my needs for multiple images per link and also multiple thumbs per image. And, everything was fine till the moment I've tried to use it under mod_perl, when user tries to upload the image GLinks takes care of uploading but after that when I run subroutine for thumbnailing Apache returns 500 Server Error :(

Does anyone else run in to such a problem?
This is killing me :(

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Image::Magick and mod_perl won't work together In reply to
What's the error?

Oh, missed the part about Image::Magick. It's known to cause segfaults while being run under modperl. We usually just run it by calling the convert binary for this reason.

Adrian

Last edited by:

brewt: Dec 3, 2009, 1:11 PM
Quote Reply
Re: [brewt] Image::Magick and mod_perl won't work together In reply to
No error at all :(

Code:
my $main = $resizer->Read($image->{image_path});
if ($main) { warn "Error: $main";}
on this code $main is undef no errors no clue, but still Apache returns 500 error.
Weird!

So you propose me to use exec to binary instead?

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Image::Magick and mod_perl won't work together In reply to
What is the corresponding error in your server error log?

----
Cheers,

Dan
Founder and CEO

LionsGate Creative
GoodPassRobot
Magelln
Quote Reply
Re: [dan] Image::Magick and mod_perl won't work together In reply to
Hi, Dan

Code:
Premature end of script headers:


But that gives no clue, the situation happens when IM actually start reading the image and it returns no error on this only 500 Status from Apache and the line in error log above.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Image::Magick and mod_perl won't work together In reply to
Hi,

We had the same problem with the Image::Magick module under mod_perl.

As Adrian suggested, I would just try it using the command line:

`convert ...`

Here is an example from a script I did a while back:

Code:
my $command = qq~convert '$path' -resize ${width}x${height} $WriteImage ~;
`$command`;

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] Image::Magick and mod_perl won't work together In reply to
Thanks Andy,
I've done the same last night Whistle

But ported my code a bit to work on both with checking if GLinks running under persist environment, because i tested with speedy_cgi too and seems ImageMagick have problem with too Frown

And in this light, which one is better GD or ImageMagick for thumbnailing, which is faster?
For now I see GD has some very nasty command syntax, but ImageMagick have nasty error handling, and also seems they not update often documentation for perl modules.

Cheers,
Boris

Facebook, Twitter and Google+ Auth for GLinks and GCommunity | reCAPTCHA for GLinks | Free GLinks Plugins
Quote Reply
Re: [eupos] Image::Magick and mod_perl won't work together In reply to
Hi,

Well, with GD - you could try using http://search.cpan.org/...Resize-0.5/Resize.pm , which I use (makes it sooo much easier than entering loads of paramaters etc)

In terms of speed - afraid I'm not sure (I would imagine GD is quicker, but can't proove that as I've never done any benchmark tests =))

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!