Installing and using PHP ImageMagick (Imagick) Module
June 9th, 2009
Warning: This post is 15 years old. Some of this information may be out of date.
Installation
On an Ubuntu System:
sudo apt-get install imagemagick libmagick9-dev php5-imagick php5-dev
wget http://pecl.php.net/get/imagick-3.0.0b1.tgz
tar xvfz imagick-3.0.0b1.tgz
cd imagick-3.0.0b1
phpize && ./configure
sudo make
sudo make install
sudo apache2ctl graceful
Example Usage:
<?php
//Create two Imagick objects
$first = new Imagick('tshirt.png');
$second = new Imagick('photo.jpg');
$first->compositeImage($second, Imagick::COMPOSITE_MULTIPLY, 220, 141);
//new image is saved as final.jpg
$first->setImageFormat('jpg');
header('content-type: image/jpeg');
echo $first->getImage();
Previous →
Upload files with ncftpput