MagickWand

MagickWand is a wrapper around imagemagick (convert, compose etc) and ghostscript (gs) that lets PHP developers manipulate PNG, GIF or JPEG images or PDF files !

installation
Installation of magickwand is almost impossible in CentOS, OEL or RHEL but here's how i did it and how i fixed these errors:

PHP Warning:  PHP Startup: 
Unable to load dynamic library '/usr/lib/php/modules/magickwand.so' - libMagickWand.so.1: 
cannot open shared object file: 
No such file or directory in Unknown on line 0

PHP Warning:  PHP Startup: 
fileinfo: Unable to initialize module
Module compiled with module API=20050922, debug=0, thread-safety=0
PHP compiled with module API=20060613, debug=0, thread-safety=0
These options need to match in Unknown on line 0


uninstall old versions of ImageMagick
MagickWand needs ImageMagick version 6.3.5 or greater so will not work with ImageMagick 6.2.8 that is packaged with CentOS so you must uninstall that one

# yum remove php-pecl-Fileinfo.
# yum remove ImageMagick*
# yum install php
# yum install php-devel


Get ImageMagick 6.5.5+
Get ImageMagick sourcecode from tar
$ wget ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz
$ tar zxvf ImageMagick.tar.gz

or from svn if you need an older version such as 6.5.5
$ svn co https://www.imagemagick.org/subversion/ImageMagick/branches/ImageMagick-6.5.5/ ImageMagick 


Configure and compile ImageMagick 6.5.5+
Configure and compile ImageMagick 6.5.5+
$ cd ImageMagick
$ ./configure
$ make
$ su
# make install
# exit
$

should install convert, composite etc utilities into
/usr/local/bin

instead of the CentOS package default of
/usr/bin


This is the only way to create the all important
Magick-config
Magick++-config
MagickCore-config
MagickWand-config

utilities that you need to prevent getting the error
Cannot locate configuration program MagickWand-config

in the next phase of the process

Configure and compile MagickWand
Configure and compile MagickWand 1.0.7
$ wget http://www.magickwand.org/download/php/MagickWandForPHP-1.0.7.tar.gz
$ tar zxvf MagickWandForPHP-1.0.7.tar.gz


$ cd MagickWand
$ phpize
$ ./configure
$ make
$ su
# make install 
or 
# cp modules/magickwand.so /usr/lib/php/modules
or
# cp modules/magickwand.so /usr/lib64/php/modules/
# vi /etc/php.ini


and add
extension=magickwand.so


restart apache httpd with magickwand module
# service httpd restart
# exit
$


tips
sometimes yum remove doesnt work properly and leaves old (now broken) imagemagick convert binarys around
$ convert -version
convert: error while loading shared libraries: libMagick.so.10: cannot open shared object file: No such file or directory


$ /usr/local/bin/convert -version
Version: ImageMagick 6.5.7-7 2009-11-13 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2009 ImageMagick Studio LLC
Features: OpenMP 


you'll need to manually delete all the old imagemagick binarys from /usr/bin

MagickWandExamples


REFERRERS
MagickWandExamples
PHP
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki