diff --git a/src/GifCreator/GifCreator.php b/src/GifCreator/GifCreator.php index 0726243..35b511b 100644 --- a/src/GifCreator/GifCreator.php +++ b/src/GifCreator/GifCreator.php @@ -84,7 +84,7 @@ public function __construct() */ public function create($frames = array(), $durations = array(), $loop = 0) { - if (!is_array($frames) && !is_array($GIF_tim)) { + if (!is_array($frames) && !is_array($durations)) { throw new \Exception($this->version.': '.$this->errors['ERR00']); } @@ -168,8 +168,12 @@ public function create($frames = array(), $durations = array(), $loop = 0) $this->gifAddHeader(); for ($i = 0; $i < count($this->frameSources); $i++) { - - $this->addGifFrames($i, $durations[$i]); + $frameduration = $durations[0]; + + if(count($durations) > 1) + $frameduration = $durations[$i]; + + $this->addGifFrames($i, $frameduration); } $this->gifAddFooter();