Activities

January 2010
M T W T F S S
« Dec   Feb »
 123
45678910
11121314151617
18192021222324
25262728293031

Enabling php-imagick on CentOS

Question.

I want to enable imagic extension on php. I uses Centos5 and php was compiled by hand.

Solution.

#yum install  ImageMagick*
[root@rc-clone]#pecl install imagick
#sometimes you may have ask to install gcc compiler. if so execute #yum install gcc*
added the extension on php.ini
[root@rc-clone]#echo "extension=imagick.so"  /etc/php.ini
[root@rc-clone installation]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]
[root@rc-clone installation]#

How to do I verify the installation ?

[root@rc-clone installation]# php -r 'phpinfo();'|grep "imagic"
imagick
imagick module => enabled
imagick module version => 3.0.1
imagick classes => Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator
imagick.locale_fix => 0 => 0
imagick.progress_monitor => 0 => 0
[root@rc-clone installation]#

Note: if you got this error “Please provide a path to MagickWand-config or Wand-config program.” when installing on Linux (in this case CentOS aka Red Hat).” then install ImageMagick-devel package. After restarting the web server , you can see the extension named ” imagic” should be shown like this follow,

You can verify the command line installation by executing the following command

[root@rc-clone]#convert logo: logo.gif
[root@rc-clone]#identify logo.gif
[root@rc-clone]#display logo.gif

You will see a nice imagemagic logo displayed on the screen.
#convert image.jpg image.png

For example, suppose you want to convert 1.jpg, 2.jpg, 3.jpg, 4.jpg, and 5.jpg in your current directory to a GIF animation,

#convert *.jpg images.gif

Suppose you have hundreds of large JPEG images that you taken on your camera ,you want to convert to a sequence of JPEG pics . So that you can upload it to web.

a. Open command window (dos mode)

b. Go to the folders where all the images are copied and execute the following command,

convert *.jpg  -resize 1024x768 snaps%timestamp%.jpeg

imagick

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>