Try 01
Code: Select all
if ($extension === 'gif') {
$imagick = new Imagick($_FILES['file']['tmp_name']);
foreach ($imageFolders as $imageFolder => $size) {
if ($imagick->getImageWidth() > $size['minWidth']) {
$width = $size['maxWidth'];
$height = $size['maxWidth'];
} else {
$width = $imagick->getImageWidth();
$height = $imagick->getImageHeight();
}
$imagick->coalesceImages();
do {
$imagick->scaleImage($width, $height, Imagick::FILTER_BOX, 1);
} while ($imagick->nextImage());
$imagick = $imagick->deconstructImages();
$imagick->writeImages($imagePath, true);
}
$imagick->clear();
$imagick->destroy();
}
Code: Select all
$imagick = new Imagick($_FILES['file']['tmp_name']);
foreach ($imageFolders as $imageFolder => $size) {
if ($imagick->getImageWidth() > $size['minWidth']) {
$width = $size['maxWidth'];
$height = $size['maxWidth'];
} else {
$width = $imagick->getImageWidth();
$height = $imagick->getImageHeight();
}
$imagick = $imagick->coalesceImages();
foreach($imagick as $frame){
$frame->thumbnailImage($width , $height );
$frame->setImagePage($width , $height , 0, 0);
}
$imagick = $imagick->deconstructImages();
$imagick->writeImages($imagePath, true);
}
$imagick->clear();
$imagick->destroy();