MagickWand 是一個PHP的模塊,用來訪問 ImageMagick 的圖像處理庫。下面是一個使用 MagicWand 的代碼片段:
- <?php
- $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);
- }
- ?>
安裝方法:
下載 php_magickwand_q16_st.dll for 5.2.x
將其放在PHP的擴展目錄
在php.ini文件總增加 extension=php_magickwand_q16_st.dll
重新啟動apache