PHP ImageMagick extension on Windows
Install the PHP ImageMagick extension on Windows, you will have the download links to your PHP version to install it.
In order to install the imagick PHP extension on Windows, you need to know the exact version of your PHP. To do this, open a command prompt and as “Administrator” enter these commands
Determines the PHP version:
Determines if the php is in thread safety mode or not
Determines the architecture if it is 32-bit or 64-bit
Once you have downloaded the correct :
- Unzip the php_imagick file
- Search for the php_imagick.dll file,
- Save it in the ext directory of your PHP installation. For me it is in c:\php\ext\
- Copy all the other DLL files (they may start with CORE_RL, FILTER, IM_MOD_RL, or ImageMagickObject depending on the version)
- Save them in the PHP root directory. For me this is in c:\php\ (where you have php.exe).
Configuring your php.ini file
Restart the Apache service.
- Right click on the Windows button
- Computer Management
Then you click right on Apache 2.4
And you restart the Apache service
To test if the extension works, you can run this PHP code :
<?php $image = new Imagick(); $image->newImage(1, 1, new ImagickPixel('#ffffff')); $image->setImageFormat('png'); $pngData = $image->getImagesBlob(); echo strpos($pngData, "\x89PNG\r\n\x1a\n") === 0 ? 'Ok' : 'Failed';