I've activated the ImageMagick extension as per the KnowledgeBase article
Basically, adding this line to php.ini
:
open_basedir = /nfs:/tmp:/usr/local:/etc/apache2/gs-bin:/usr/bin/convert
However, this doesn't seem to work.
This script outputs the version number just fine:
$IM_version=shell_exec("/usr/bin/convert -version");
echo $IM_version;
However, when I try to use the Imagick
class I get an error.
try
{
/*** a new imagick object ***/
$im = new Imagick();
/*** Create a red rectangle ***/
$im->newImage( 200, 100, "red", "png" );
/*** write image to disk ***/
$im->writeImage( '/tmp/rectangle.png' );
echo 'Image Created';
}
catch(Exception $e)
{
echo $e->getMessage();
}
Error:
Fatal error: Class 'Imagick' not found in /xxxxxxxxxxxxxxx/html/mt.php on line 8
Any ideas what I'm doing wrong or what the next step for troubleshooting is?
I've contacted MediaTemple support and they just said "sorry but because the script outputs the version number it proves it's installed"
Ok, I got this working but it was a bit tricky. Here goes...
First, you'll want to install ImageMagick from source. This step may be optional if you already have access to 'MagickWand-config', but it wasn't in my path. Here were the steps I followed to install it into an alternate directory on the (gs):
Note: As of this post, the latest release was 6.8.9.3.
The Imagick PHP class is a PECL extension so we will install it using the provided KB from Media Temple with one change. Here are the steps:
This is where our script deviates from the instructions. We need to specify the path to our ImageMagick install to use 'MagickWand-config'. If this isn't specified, you'll see the following error:
If you've used an alternate location for the source install of ImageMagick, replace the path for '--with-imagick' with that path.
Resuming the normal instructions:
Update your php.ini file, which should be located at /home/#####/etc/php.ini and add these 2 lines:
Once complete, here is the script I ran:
Output: