Page 1 of 1

Little help with appendImages()

Posted: 2011-03-31T06:32:45-07:00
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

Re: Little help with appendImages()

Posted: 2011-04-01T20:11:15-07:00
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);