When save image and resize it on server not working
its take more than 30 seconds and throw Exception
Imagick/Image.php 292 Maximum execution time of 30 seconds exceeded
public static function saveAndResize($image, $name, $width, $height, $small = false)
{ $path = self::CDN_PATH . $name;
$savePath = Yii::getAlias($path);
if (!$image->saveAs($savePath, !$small)) {
return false;
}
Image::resize($savePath, $width, $height)->save($savePath);
if ($small) {
$fullName = explode('/', $name);
$path = self::CDN_PATH . $fullName[0] . "/preview/" . $fullName[1];
self::createDirectoryIfNotExists($fullName[0] . "/preview");
$savePath = Yii::getAlias($path);
if (!$image->saveAs($savePath)) {
die($savePath);
return false;
}
Image::resize($savePath, 1200, 1500)->save($savePath);
}
return true;
}