Issues with ImageMagick/Mod_perl/Html::mason

Today, i was working with a web-based mod_perl application running on an old rhel 2.1 (panama) server, with apache v1.3.33 and mod_perl v1.29.

The applctn had an option to upload images for the products displayed on the site. But the app lacked image resizing functionality. Some of the users had uploaded huge images and that went beyond the site borders. I was about to integrate the resizing function using perl’s Image::Magick module. Existing module was out-dated, so i went for an upgrade. Obviously, it was not a quick and easy upgrade.

For the code snip

$image = Image::Magick->new;
$x = $image->Read($imgname);
if($x eq ”)
$image->Resize( geometry => ‘800×800’ );

The first error i met was

Can’t load ‘/usr/lib/perl5/site_perl/5.6.1/i386-linux/auto/Image/Magick/’

i ran ldd command on, and link was found broken

ldd /usr/lib/perl5/site_perl/5.6.1/i386-linux/auto/Image/Magick/ => not found

So downloaded ImageMagick-6.2.3-6.tar.gz and reinstalled ImageMagick.

For a successful compile, i had to comment the following lines in /usr/src/ImageMagick-6.2.3/magick/annotate.c

//      if (LocaleCompare(encoding,"Latin-1") == 0)
//        encoding_type=ft_encoding_latin_1;

because ( i guess ) the machine lacked that font.
After that, the app threw another error
Wrong JPEG library version: library is 62, caller expects 70

This was fixed by relinking to I know its dirty, but that did the trick.

Hope, mod_perl/mason players will find this useful.