requestImg, $demande->requestImg . '.ico'); $icoFile = $demande->requestImg . '.ico'; if (empty(Imagick::queryFormats("ICO"))) { throw new \Exception('Unsupported format'); } $im = new Imagick($icoFile); $targetWidth = $targetHeight = $size; if ($im->getImageWidth() <> $targetWidth || $im->getImageHeight() <> $targetHeight) { $im->cropThumbnailImage($targetWidth, $targetHeight); } $im->writeImage($demande->requestImg); unlink($icoFile); } }