MagickWand 是一个PHP的模块,用来访问 ImageMagick 的图像处理库。下面是一个使用 MagicWand 的代码片段:
- <?php
- $magick_wand=NewMagickWand();
- MagickReadImage($magick_wand,'rose.jpg?http://www.xvna.com');
- $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);
- }
- ?>
安装方法:
下载 php_magickwand_q16_st.dll for 5.2.x
将其放在PHP的扩展目录
在php.ini文件总增加 extension=php_magickwand_q16_st.dll
重新启动apache