/** * save image in to destination * @param resurce $image * @param string $name * @param string $dest full path with file name */ protected function imageSave($image, $dest) { //prepare folder $this->makeFolder(dirname($dest)); //prepare to save if ($this->format == 'jpeg') { $image->setCompression(Imagick::COMPRESSION_JPEG); $image->setCompressionQuality($this->quality_jpeg); } //save image if (!$image->writeImage($dest)) { throw new RuntimeException('Cannot save image ' . $dest); } return true; }