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 => '800x800' );
$image->Write($imgname);
}

The first error i met was

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

i ran ldd command on Magick.so, and libMagick.so link was found broken

ldd /usr/lib/perl5/site_perl/5.6.1/i386-linux/auto/Image/Magick/Magick.so
libMagick.so.6 => 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 libjpeg.so.62 to libjpeg.so.7.0.0. I know its dirty, but that did the trick.

Hope, mod_perl/mason players will find this useful.

VN:F [1.9.6_1107]
Rating: 6.6/10 (5 votes cast)
VN:F [1.9.6_1107]
Rating: +2 (from 2 votes)
Issues with ImageMagick/Mod_perl/Html::mason, 6.6 out of 10 based on 5 ratings
Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • Live
  • StumbleUpon
  • Twitter
  • Yahoo! Buzz
  • Reddit
  • Technorati