PHP ImageMagick Library Installation use

Source: Internet
Author: User
Tags imagemagick

ImageMagick Introduction:

Imagemagick®is a software suite to create, edit, compose, or convert bitmap images. It can read and write images in a variety of formats (over) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PNG, POSTSC Ript, SVG, and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and transform images, adjust image colors, apply various s Pecial effects, or draw text, lines, polygons, ellipses and Bézier curves.

The Functionality of ImageMagick is typically utilized from the command line or yo U can use the features from programs written in your favorite language. Choose from these interfaces: g2f  (Ada), magickcore  (c), magickwand  (c),  chmagick  (Ch), imagemagickobject  (COM +), magick++  (c + +),jmagick  (Java),  l-magick  (Lisp), lua, nmagick  (neko/haxe), magick.net  (. NET),  PascalMagick   (Pascal), perlmagick  (Perl),  magickwand for PHP (PHP), imagick  (PHP),  pythonmagick  (Python), rmagick  (Ruby), or tclmagick  (TCL/TK). With a language interface, use ImageMagick to modify or create images dynamically and  automagically .

ImageMagick is free software delivered as a ready-to-run binary distribution or as source code this you could use, copy, mod Ify, and distribute in both open and proprietary applications. It is distributed under the Apache 2.0 license, approved by the OSI and recommended for use by the OSSCC.

The ImageMagick development process ensures a stable API and ABI. Before ImageMagick release, we perform a comprehensive security assessment that includes memory error and thread data Race detection to prevent security vulnerabilities.

The current release was ImageMagick 6.9.0-3 available from Http://www.imagemagick.org/download. It runs on Linux, Windows, Mac os X, IOS, Android Os, and others.

The authoritative ImageMagick Web site is http://www.imagemagick.org.

The famous image service provider Flickr uses ImageMagick, and Yupoo, the home of the mobile phone is also imagemagick.

Download: http://www.imagemagick.org/download/

Windows installation:

Download Windows edition:

After installation, the PHP extension is installed: The official recommended 3:

Magickwand for PHP A native php-extension to the ImageMagick magickwand API.

Imagick is a native PHP extension to create and modify images using the ImageMagick API. Documentation for the extension are available here.

Phmagick is a wrapper class for ImageMagick, wrapping the most common web image manipulation actions on easy to use FUNCTI ONS, but allowing full access to ImageMagick's power by issuing system calls to it's command-line programs.

decided to use Imagick.

DLL extensions under Windows in Imagick

Rename to Php_imagick.dll and copy to PHP's ext folder
Adding settings to the php.ini file
Extension=php_imagick.dll
After viewing phpinfo () There is no Imagick column, if you have some words can be tested.

Reference: http://blog.sina.com.cn/s/blog_966e43000101bgqj.html

Linux Installation:

Download Source code:

Refer to the official tutorials:

$ CD ImageMagick-6.9.0

$ ./configure

$ Make

Make install

Execution:/usr/local/imagemagick/bin/convert logo:logo.gif test to see if ImageMagick works.

Or: Convert-version

2. Install PHP Extension: Imagick

The latest package can be found in the address below Http://pecl.php.net/package/imagick

1
2
3
4
5
6
7
8
9
10
11
12
wget http://pecl.php.net/get/imagick-3.0.1.tgz
Tar zxvf imagick-3.0.1.tgz
CD IMAGICK-3.0.1/
Export Pkg_config_path=/usr/local/imagemagick/lib/pkgconfig
/usr/local/php/bin/phpize
./configure--with-php-config=/usr/local/php/bin/php-config--with-imagick=/usr/local/imagemagick
Make && make install

/usr/local/php_fcgi/bin/phpize
./configure--with-php-config=/usr/local/php_fcgi/bin/php-config--with-imagick=/usr/local/imagemagick
Make && make install
Cd.. /

Edit/usr/local/php/etc/php.ini add: Extension = "imagick.so"

Edit/usr/local/php_fcgi/etc/php.ini add: Extension = "imagick.so"

Restart PHP-FPM or Apache.

Lu-restart

Try it first, then execute: ldconfig, reload some of the link libraries.

(I use the Pecl install Imagick installation, after installation prompts:

You should add "extension=imagick.so" to PHP.ini

Increase on the line. )

Php_imagick Program Examples

1. Create a thumbnail image and display it
<?php
Header (' Content-type:image/jpeg ');
$image = new Imagick (' image.jpg ');
If 0 is provided as a width or height parameter,//aspect ratio is maintained
$image->thumbnailimage (100, 0);
Echo $image;
?>

2. Create a thumbnail in a directory and save
<?php
$images = new Imagick (Glob (' images
$im = new Imagick ("Example.gif");

foreach ($im as $frame) {

$frame->thumbnailimage (50, 50);

$frame->setimagepage (50, 50, 0, 0);
}
$im->writeimages ("Example_small.gif", true);
?>

Http://blog.sina.com.cn/s/blog_8da982ac010171iz.html

http://blog.csdn.net/andy1219111/article/details/38335987

http://blog.csdn.net/czloveyeer/article/details/8179766

http://blog.lizhigang.net/archives/228

Document:

http://php.net/manual/zh/book.imagick.php

Http://www.bitscn.com/pdb/php/201407/235972.html

PHP ImageMagick Library Installation use

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.