note 102911 modified in function.imagick-setiteratorindex by danbrown

From: Date: Mon, 14 Mar 2011 18:15:03 +0000
Subject: note 102911 modified in function.imagick-setiteratorindex by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-177863@lists.php.net to get a copy of this message
This function returns true on success but setting the iterator to an invalid index throws an exception instead of returning false: Fatal error: Uncaught exception 'ImagickException' with message 'Unable to set iterator index' This can happen when counting images inside a gif file, because the iterator count starts at zero and not one. If you count the number of images in a gif file be sure to use iterator 0 for the first image, like this: <?php $image = new Imagick('simple.gif'); $image->setIteratorIndex(0); ?> --was-- This function returns true on success but setting the iterator to an invalid index throws an exception instead of returning false: Fatal error: Uncaught exception 'ImagickException' with message 'Unable to set iterator index' This can happen when counting images inside a gif file, because the iterator count starts at zero and not one. If you count the number of images in a gif file be sure to use iterator 0 for the first image, like this: $image = new Imagick('simple.gif'); $image->setIteratorIndex(0); http://php.net/manual/en/function.imagick-setiteratorindex.php

« previous php.notes (#177863) next »