| @@ 187-201 (lines=15) @@ | ||
| 184 | try { |
|
| 185 | $img = new imagick($src); |
|
| 186 | ||
| 187 | if (strtoupper($img->getImageFormat()) === 'JPEG') { |
|
| 188 | $img->setImageCompression(imagick::COMPRESSION_JPEG); |
|
| 189 | $img->setImageCompressionQuality($quality); |
|
| 190 | if (!$preserveExif) { |
|
| 191 | try { |
|
| 192 | $orientation = $img->getImageOrientation(); |
|
| 193 | } catch (ImagickException $e) { |
|
| 194 | $orientation = 0; |
|
| 195 | } |
|
| 196 | $img->stripImage(); |
|
| 197 | if ($orientation) { |
|
| 198 | $img->setImageOrientation($orientation); |
|
| 199 | } |
|
| 200 | } |
|
| 201 | } |
|
| 202 | ||
| 203 | $img->resizeImage($width, $height, Imagick::FILTER_LANCZOS, true); |
|
| 204 | ||
| @@ 4213-4225 (lines=13) @@ | ||
| 4210 | $img->setImageFormat('jpeg'); |
|
| 4211 | } |
|
| 4212 | } |
|
| 4213 | if (strtoupper($img->getImageFormat()) === 'JPEG') { |
|
| 4214 | $img->setImageCompression(imagick::COMPRESSION_JPEG); |
|
| 4215 | $img->setImageCompressionQuality($jpgQuality); |
|
| 4216 | try { |
|
| 4217 | $orientation = $img->getImageOrientation(); |
|
| 4218 | } catch (ImagickException $e) { |
|
| 4219 | $orientation = 0; |
|
| 4220 | } |
|
| 4221 | $img->stripImage(); |
|
| 4222 | if ($orientation) { |
|
| 4223 | $img->setImageOrientation($orientation); |
|
| 4224 | } |
|
| 4225 | } |
|
| 4226 | $result = $img->writeImage($filename); |
|
| 4227 | } catch (Exception $e) { |
|
| 4228 | $result = false; |
|