PHP Image processing Class Library Magickwand Usage Example Analysis _php tutorial

Source: Internet
Author: User
Tags imagemagick php website

An example analysis of magickwand usage of PHP image processing class Library


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:

?

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

$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 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/1003824.html www.bkjia.com true http://www.bkjia.com/PHPjc/1003824.html techarticle PHP Image processing class Library Magickwand Usage Example 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 ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.