In order to process images with php using image processing functions, you need to have Imagemagick support installed. Since I haven’t found any clear reference, how to do it fast, let me post my solution, it should help you to add Imagemagick support to your PHP installation.
First of all, we need to ensure we’ve got Imagemagick on our server. Please, read my previous post, where the procedure of Imagemagick setup is explained, if you don’t have it installed. You need to install Imagemagick first in order to add its functions in PHP, I hope it’s clear.
After the main library is installed, we will need another source archive, that will allow us to add Imagemagick functions to PHP. This package is called Imagick, and you’re welcome to select one package you like. I’ve taken 3.0.0b2 beta, the most recent for today.
Let’s download it to our server:
Extract to a folder:
tar -xzvf imagick-3.0.0b2.tgz
cd into this folder
Then we need to run phpize
Then our usual list of commands:
After you’ve built imagick, you should see something like this:
Now you need to copy the created library named imagick.so to your extensions directory. However you can skip this step, if you like to deal with ling paths in your php.ini.
And the final stage is to add imagick module to php.ini. If you have copied the library to your extensions directory, you should add the following line to php.ini:
If you have decided to keep the library at the place where it was installed, the string will look like
Now restart Apache and check your phpinfo(). If everything is OK, you should see:
You should now be able to use Imagemagick functions. Feel free to ask me any questions you have.