Little help with appendImages()

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
CappY
Posts: 1
Joined: 2011-03-31T05:40:05-07:00
Authentication code: 8675308

Little help with appendImages()

Post by CappY »

Hello.... I need a little help with php Imagick. Let's say I have 3 images, and I want to append them 1 - 2 - 3 (next to each other) but in some cases I want to append them in that order 3 - 1 - 2 or 2 - 1 - 3.

What's the easiest way to achieve that? Right now I'm using that way ( would be using if statement )

Code: Select all

$image->readImage(SECOND IMAGE);
$image->resetIterator();
$image = $image->appendImages(false);

$image->readImage(THIRD IMAGE);
$image->resetIterator();
$image = $image->appendImages(false);
Here is my question in stackoverflow
DJ Mike
Posts: 33
Joined: 2010-06-29T19:07:53-07:00
Authentication code: 8675308

Re: Little help with appendImages()

Post by DJ Mike »

You could have the images in an array. Your if statement would load them into the array in the order that you want.

Code: Select all

$images = array("1.jpg", "2.jpg", "3.jpg");
foreach($images as $temp)
    {
    $image->readImage("$temp"); 
    }
$image->resetIterator();
$image = $image->appendImages(false); 
DJ Mike's Tutorials: PHP
ImageMagick Functions
http://eclecticdjs.com/mike/tutorials/p ... /index.php
Post Reply