Magickwand iterator not working!!!

MagickWand for PHP is an object-oriented PHP interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning MagickWand for PHP.
Post Reply
jagadeeshvn

Magickwand iterator not working!!!

Post by jagadeeshvn »

Hey,

I am trying to do an image montage using MagickMontageImage with a set of images. However I noticed that montage is working fine in Windows and not working in my development server which is Fedora Core 5. By not working I mean the images are stitched together but it is always 2 images irrespective of the input. I tried with 7 images and got an output with 2 images stitched.

So I did some more work on this by iterating the images in Magickwand and found that there were only 2 images in the sequence.

Code: Select all

function create_montage($filenames, $output_path){

	$mgk = NewMagickWand();
	$drw = NewDrawingWand();
	$width = 0;
	$height=0;
	$count = 0;
	foreach( $filenames as $filename){
		$b1 = MagickReadImage($mgk, $filename);
                echo $filename . " = " . $b1 . "<BR>";
	}

	MagickResetIterator( $mgk );

	while( MagickHasNextImage( $mgk ) ){
		MagickNextImage( $mgk );
		echo MagickGetImageFilename($mgk) . "<BR>";
	}
}

$images = Array();

$images[0] = '/tmp/88271534_db6281aa48_m.jpg';
$images[1] = '/tmp/820561_3374efc3e9_m.jpg';
$images[2] = '/tmp/820567_68d076197c_m.jpg';
$images[3] = '/tmp/88271534_db6281aa48_m.jpg';
$images[4] = '/tmp/OdYr08nCrQrE_1190597124.jpg';
$images[5] = '/tmp/337213047_9faebc2b67_m.jpg';
$images[6] = '/tmp/348902357_6f52336f3f_m.jpg';
create_montage($images,'/tmp/output.jpg');

This is the output I got.

Code: Select all

/tmp/88271534_db6281aa48_m.jpg = 1
/tmp/820561_3374efc3e9_m.jpg = 1
/tmp/820567_68d076197c_m.jpg = 1
/tmp/88271534_db6281aa48_m.jpg = 1
/tmp/OdYr08nCrQrE_1190597124.jpg = 1
/tmp/337213047_9faebc2b67_m.jpg = 1
/tmp/348902357_6f52336f3f_m.jpg = 1

/tmp/820561_3374efc3e9_m.jpg
/tmp/88271534_db6281aa48_m.jpg
My ImageMagick version is ImageMagick 6.2.5

Could someone please tell me what I am doing wrong here!

Thanks
Jugs
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: Magickwand iterator not working!!!

Post by magick »

Did you install MagickWand for PHP 1.0.5? We tried ImageMagick 6.3.5-10 with MagickWand for PHP 1.0.5 and it produced expected results (7 images).
Post Reply