This article illustrates the Magickwand usage of the PHP image processing class library. Share to everyone for your reference. The specific analysis is as follows:
Magickwand is an extender for PHP that creates an interaction with ImageMagick to process images. It is an excellent alternative to the default GD image function library. In terms of security and ease of use, using Magickwand in PHP is much more secure and quicker than using command line ImageMagick. In addition, Imagick can also be used in PHP as a imagemagick alternative.
There are two forms of Magickwand,
Just establish an interaction with ImageMagick, which must first install ImageMagick, the advantage is that the Extender file is small (general hundreds of k), you can quickly upgrade the ImageMagick version, but the Windows Temp directory requires special permissions.
The Extender itself contains ImageMagick, with the advantage that no additional installation ImageMagick is required, and the temporary directory does not require special permissions, but the Extender file is larger (more than 4M in general).
Magickwand default is not in the PHP installation package, you need to download the PHP Web site, and open this extension in php.ini.
Here is a snippet of code using Magicwand:
$magick _wand=newmagickwand ();
Magickreadimage ($magick _wand, ' rose.jpg ');
$drawing _wand=newdrawingwand ();
Drawsetfont ($drawing _wand, "/usr/share/fonts/bitstream-vera/vera.ttf");
Drawsetfontsize ($drawing _wand,20);
Drawsetgravity ($drawing _wand,mw_centergravity);
$pixel _wand=newpixelwand ();
Pixelsetcolor ($pixel _wand, "white");
Drawsetfillcolor ($drawing _wand, $pixel _wand);
if (Magickannotateimage ($magick _wand, $drawing _wand,0,0,0, "Rose")!= 0)
{
Magickechoimageblob ($magick _ Wand);
}
else
{
echo magickgetexceptionstring ($magick _wand);
Installation method:
1. Download Php_magickwand_q16_st.dll for 5.2.x
2. Place it in the extended directory of PHP
3. Total increase in php.ini documents Extension=php_magickwand_q16_st.dll
4. Restart Apache
I hope this article will help you with your PHP program design.