PHP Image processing Class Library Magickwand Usage example analysis, magickwand instance analysis
This article describes the PHP image processing class library Magickwand usage. Share to everyone for your reference. The specific analysis is as follows:
Magickwand is an extension of PHP, through which the interaction with the ImageMagick is established and the image is processed. It is an excellent alternative to the default GD image library. In terms of security and ease of use, using Magickwand in PHP is much safer and quicker than using command-line ImageMagick. In addition, Imagick can also be used as an alternative to ImageMagick in PHP.
There are two forms of Magickwand,
Just establish an interaction with ImageMagick, this situation must first install ImageMagick, the advantage is that the extension file small (generally hundreds of k), you can quickly upgrade the ImageMagick version, but the Windows temporary directory requires special permissions.
The Extender itself contains ImageMagick, with the advantage that no additional installation ImageMagick is required, the temporary directory does not require special permissions, but the Extender file is larger (typically 4M or more).
Magickwand default is not in the PHP installation package, need to go to PHP website download, and open this extension in php.ini.
Here is a code snippet that uses Magicwand:
$magick _wand=newmagickwand (); Magickreadimage ($magick _wand, ' rose.jpg '); $drawing _wand=newdrawingwand ();D Rawsetfont ($drawing _wand, "/usr/share/ Fonts/bitstream-vera/vera.ttf ");D rawsetfontsize ($drawing _wand,20);D rawsetgravity ($drawing _wand,mw_ centergravity); $pixel _wand=newpixelwand (); Pixelsetcolor ($pixel _wand, "white");D Rawsetfillcolor ($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 PHP extensions directory
3. Total increase in php.ini files Extension=php_magickwand_q16_st.dll
4. Restart Apache
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/1003998.html www.bkjia.com true http://www.bkjia.com/PHPjc/1003998.html techarticle PHP Image processing class Library Magickwand Usage example analysis, magickwand instance Analysis This paper describes the PHP image processing class library Magickwand usage. Share to everyone for your reference. A specific analysis such as ...