2

I want the functionality, but I can't for the life of me figure out what to do with the function described here: http://php.net/manual/en/imagick.montageimage.php . Googling has been unproductive so far.

I have read this http://www.imagemagick.org/Usage/montage/ and it seems easy enough in command line, but how do you specify the URLs to operate on in PHP?

I've also seen this, but it only makes me more confused since the guy doing it says it doesn't work for him. Imagick PHP Extension -- Montage help?

Community
  • 1
  • 1
Dmitri
  • 1,338
  • 1
  • 12
  • 24

2 Answers2

1

I do not know how to do it with Imagick but with command line and php it would be this:

exec("montage balloon.gif medical.gif present.gif shading.gif montage.jpg");

You can use variables:

exec("montage $image1 $image2 $image3 $image4 $output");

You could create a loop and concenate? all the images into one variable so that the variable would be:

$images = "$image1 $image2 $image3 $image4";

exec("montage $images $output");

You can probably see Imagemagick with exec( ) is a lot simpler than Imagick.

I am not sure if you could use an array of images.

Bonzo
  • 5,169
  • 1
  • 19
  • 27
0

I agree - the php method montageImage() is very confusing. I found another approach using appendImages() instead.

This is how I tile pngs generated from a pdf horizontally:

$im = new Imagick();
$im->readimageblob($blob);
$im->setiteratorindex(0); // start at first page (blob-specific)
$im->setImageFormat('png'); // jpg-artifacts - not thanks
$montage = $im->appendImages(false); // true will tile vertically

Imagick::appendImages() - php.net

J.G.Sebring
  • 5,934
  • 1
  • 31
  • 42