/** * Creates a new animated gif object from a selection of files. * * @access public * @author Oliver Lillie * @param string $file_paths * @param string $frame_delay * @param string $loop_count * @return mixed Returns an AnimatedGif object on success, otherwise returns false. */ public static function createFrom(array $image_object_array, $frame_delay, $loop_count = self::UNLIMITED_LOOPS, Config $config = null) { if (empty($image_object_array) === true) { throw new Exception('At least one file path must be specified when creating an animated gif from AnimatedGif::createFrom.'); } if ($frame_delay <= 0) { throw new Exception('The frame delay must be greater than 0.'); } // create a new gif and add all the frames. $gif = new self(null, $config); foreach ($image_object_array as $key => $image) { if (is_object($image) === false || get_class($image) !== 'PHPVideoToolkit\\Image') { throw new Exception('The image at key ' . $key . ' is not an \\PHPVideoToolkit\\Image object. Each frame must be an Image object.'); } $gif->addFrame($image, $frame_delay); } // set the loop count $gif->setLoopCount($loop_count); return $gif; }