| @@ 4148-4160 (lines=13) @@ | ||
| 4145 | $img->setImageFormat('jpeg'); |
|
| 4146 | } |
|
| 4147 | } |
|
| 4148 | if (strtoupper($img->getImageFormat()) === 'JPEG') { |
|
| 4149 | $img->setImageCompression(imagick::COMPRESSION_JPEG); |
|
| 4150 | $img->setImageCompressionQuality($jpgQuality); |
|
| 4151 | try { |
|
| 4152 | $orientation = $img->getImageOrientation(); |
|
| 4153 | } catch (ImagickException $e) { |
|
| 4154 | $orientation = 0; |
|
| 4155 | } |
|
| 4156 | $img->stripImage(); |
|
| 4157 | if ($orientation) { |
|
| 4158 | $img->setImageOrientation($orientation); |
|
| 4159 | } |
|
| 4160 | } |
|
| 4161 | $result = $img->writeImage($filename); |
|
| 4162 | } catch (Exception $e) { |
|
| 4163 | $result = false; |
|
| @@ 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 | ||