downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

Constants> <png2wbmp
Last updated: Wed, 22 Jul 2009

view this page in

Imagick Image Library

Introductie

Warning

Deze module is EXPERIMENTEEL. Dat betekent, dat het gedrag van deze functies, deze functienamen, in concreto ALLES dat hier gedocumenteerd is in een toekomstige uitgave van PHP ZONDER WAARSCHUWING kan veranderen. Wees gewaarschuwd, en gebruik deze module op eigen risico.

Imagick is a native php extension to create and modify images using the ImageMagick API.

ImageMagick® is a software suite to create, edit, and compose bitmap images.. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF.

Copyright 1999-2007 ImageMagick Studio LLC, a non-profit organization dedicated to making software imaging solutions freely available.

Voorbeelden

Imagick makes image manipulation in PHP extremely easy through an OO interface. Here is a quick example on how to make a thumbnail:

Example#1 Creating a thumbnail in Imagick

<?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(1000);

echo 
$image;

?>

Using SPL and other OO features supported in Imagick, it can be simple to resize all files in a directory (useful for batch resizing large digital camera images to be web viewable). Here we use resize, as we might want to retain certain meta-data:

Example#2 Make a thumbnail of all JPG files in a directory

<?php

$images 
= new Imagick(glob('images/*.JPG'));

foreach(
$images as $image) {

    
// Providing 0 forces thumbnailImage to maintain aspect ratio
    
$image->thumbnailImage(1024,0);

}

$images->writeImages();

?>

Table of Contents



add a note add a note User Contributed Notes
Imagick Image Library
vipyzm at gmail dot com
12-Jul-2008 04:59
<?php

$first
= new Imagick('big.jpg');
$second = new Imagick('logo.png');
//$second->setImageOpacity (0.4);
$dw = new ImagickDraw();
$dw->setGravity(Imagick::GRAVITY_CENTER);
$dw->composite($second->getImageCompose(),0,0,50,0,$second);
$first->drawImage($dw);

$first->writeImage('result.jpg');
header('content-type: image/jpg');
echo
$first;
?>

Constants> <png2wbmp
Last updated: Wed, 22 Jul 2009
 
 
show source | credits | stats | sitemap | contact | advertising | mirror sites