Install Imagick

Imagick is a native extension of php to create and modify images using the API ImageMagick.
To install it in Ubuntu you will have to perform the following steps:

1. Go to the installation directory for ImageMagick:

cd /usr/local/src

2. Download ImageMagick:

You can download it from:
Link to download page ImageMagick

Example:

sudo wget ftp://mirrors.linsrv.net/pub/ImageMagick/ImageMagick-6.8.6-9.tar.gz

3. Download delegates:

You should also download the delegates that you need. The delegates are libraries that you will need to use different formats. You can download all of them in the following manner:

cd /usr/local
sudo wget ftp://mirrors.linsrv.net/pub/ImageMagick/delegates/*.tar.gz

4. Install delegates:

Now you can install the delegates. For each of them, replacing file with the corresponding delegate:

sudo tar xzvf file.tar.gz
cd file
sudo ./configure
sudo make
sudo make install

5. Unzip ImageMagick:

sudo tar -xvzf ImageMagick-6.8.6-9.tar.gz

6. Go to the uncompressed directory:

cd ImageMagick-6.8.6-9

7. Install:

sudo ./configure '--with-png=yes' '--with-jpeg=yes' '--with-jp2=yes' '--without-fpx' --enable-shared
sudo make
sudo make install

8. Symbolic link:

sudo ln -s /usr/local/include/ImageMagick-6 /usr/local/include/ImageMagick

9. I had things to do to fix an error:

In the file /usr/local/bzip2-1.0.6/Makefile replace the line:

CFLAGS=-Wall -Winline -O2 -g $(BIGFILES)

with this one:

CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) -fPIC

After this, reinstall the bzip2 software:

cd /usr/local/bzip2-1.0.6
sudo make clean
sudo make install

10. Finally, install the extension imagick:

First, add the following line to the php.ini:

extension=imagick.so

Then reinstall the extension:

sudo pecl install imagick

When it asks you for the installation directory type /usr/local. If it fails try with /opt/local.

Now restart the server:

sudo service apache2 restart

And ready to use class imagick.
If you want to know the delegates you have installed you can do the following:

convert -list configure

You can find all of the methods here: PHP official website. Class imagick.

Leave a Reply

Your email address will not be published. Required fields are marked *