Setup GraphicsMagick with PHP Extension - charleshross/soarin GitHub Wiki

This guides assumes you have already installed a fresh copy of Debian Linux Wheezy 64bit (https://www.debian.org/distrib/netinst) on your server or virtual machine.

  • Words like this are commands to run on your server or virtual machine.
  • The 'pico' text editor used in this documentation comes with Debian and is super simple to use. To open a file just type pico [location of your file]. Use arrow keys to navigate, and in order press "[CTRL]+[X], [Y], [ENTER]" to save file changes.

To begin installing, SSH into your Linux Debian server as root.

GraphicsMagick


GraphicsMagick is a great image processor and fork of imagemagick. Results will be much better quality then using PHP's built in GD library (downsampling/thumbnailing of pictures in GD is terrible in comparison).

Compile and Install GraphicsMagick


Make install directory and move into it

mkdir /opt/graphicsmagick

cd /opt/graphicsmagick

Download latest version

wget http://softlayer-ams.dl.sourceforge.net/project/graphicsmagick/graphicsmagick/1.3.19/GraphicsMagick-1.3.19.tar.gz

Unpack download

tar -xvf GraphicsMagick-1.3.19.tar.gz

Move into source folder

cd GraphicsMagick-1.3.19

Configure

./configure --prefix=/opt/graphicsmagick --without-perl --enable-shared

Make

make

Make Install

make install

GraphicsMagick is now installed

Gmagick PHP Extension


gmagick is a PHP extension to interact with the GraphicsMagick program.

2. Compile and Install gmagick PHP extension


Get dependencies

apt-get install autoconf git

Move into php folder

cd /opt/php

Clone gmagick repo

git clone https://github.com/vitoc/gmagick.git

Move into gmagick folder

cd gmagick

PHPIZE

phpize

Configure

./configure --with-gmagick=/opt/graphicsmagick

Make

make

Make Install

make install

Open php.ini in text editor

pico /opt/php/lib/php.ini

Add this line to your extensions:

extension=gmagick.so

Save and close file