Page 1 of 1

Animated Gif being weird...

Posted: Wed Feb 09, 2011 8:26 pm
by psychotomus
Everytime I upload any png file's. It just stops execution of my script and creates about 1 75MB file per png file in my directory. Any idea's on a workaround? It seems to work fine with other image file formats.

Code: Select all

<?
if(isset($_POST['SubmitForm']))
{
	//setup Imagick
    $IMG = new Imagick();
	$IMG->setFormat("gif");
	
	//loop through possible files
	for($x=1; $x< ($_POST['hidden']+1); $x++)
	{
		if(!empty($_FILES['file' . $x]['tmp_name']))
		{
			//add image to frame
			$frame = new Imagick($_FILES['file' . $x]['tmp_name']);     

			$IMG->addImage($frame);
			//100 = 1s
			$IMG->setImageDelay($delay = 50);
		}
	}

//rand name just for testing purposes
$name = rand(1, 99999);
$IMG->writeImages("$name.gif", true); // combine all image into one single image
}
?>