public function __construct($filepath) { $this->filepath = $filepath; require_once __DIR__ . '/lib/GifCreator.php'; require_once __DIR__ . '/lib/GifFrameExtractor.php'; if (GifFrameExtractor::isAnimatedGif($this->filepath)) { $gfe = new GifFrameExtractor(); $frames = $gfe->extract(); $newFrames = []; foreach ($frames as $f) { require_once __DIR__ . '/lib/PHPImageWorkshop/ImageWorkshop.php'; $layer = ImageWorkshop::initFromResourceVar($f['image']); //We use resizeScaleWidth in imagestatus //$layer->resizeInPixel($thumbWidth, $thumbHeight, $conserveProportion, $positionX, $positionY, $position); //$layer->resizeByNarrowSideInPixel($newNarrowSideWidth, $conserveProportion); } } }