Skip to content

Commit

Permalink
Resolved #2034.
Browse files Browse the repository at this point in the history
  • Loading branch information
andris-sevcenko committed Oct 18, 2017
1 parent 1cf4148 commit 13a627c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Craft CMS 3.0 Working Changelog
- Added `craft\services\AssetTransforms::getTransformUri()`.
- The installer now creates a “Common” field group.
- It's now possible to specify subpath for uploaded user photos. ([#1575](https://github.com/craftcms/cms/issues/1575))
- Added the `preserveExifData` config setting, `false` by default and requries Imagick. ([#2034](https://github.com/craftcms/cms/issues/2034))

### Changed
- Explicitly added `craft\base\PluginInterface::getVersion()`. ([#2012](https://github.com/craftcms/cms/issues/2012))
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"guzzlehttp/guzzle": "~6.2.2",
"league/flysystem": "~1.0.35",
"mikehaertl/php-shellcommand": "~1.2.5",
"pixelandtonic/imagine": "0.7.1.1",
"pixelandtonic/imagine": "0.7.1.2",
"seld/cli-prompt": "^1.0",
"twig/twig": "~2.3.0",
"yiisoft/yii2": "~2.0.12.0",
Expand Down
7 changes: 7 additions & 0 deletions src/config/GeneralConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,13 @@ class GeneralConfig extends Object
* @see getPostLogoutRedirect()
*/
public $postLogoutRedirect = '';
/**
* @var bool Whether the EXIF data should be preserved when manipulating images.
*
* Setting this to false will reduce the image size a little bit, but all EXIF data will be cleared.
* This will only have effect if Imagick is in use.
*/
public $preserveExifData = false;
/**
* @var bool Whether the embedded Image Color Profile (ICC) should be preserved when manipulating images.
*
Expand Down
10 changes: 6 additions & 4 deletions src/image/Raster.php
Original file line number Diff line number Diff line change
Expand Up @@ -361,11 +361,13 @@ public function resize(int $targetWidth = null, int $targetHeight = null)
$this->_image = $gif;
} else {
if (Craft::$app->getImages()->getIsImagick() && Craft::$app->getConfig()->getGeneral()->optimizeImageFilesize) {
$this->_image->smartResize(new Box($targetWidth,
$targetHeight), false, $this->_quality);
$config = Craft::$app->getConfig()->getGeneral();
$keepImageProfiles = $config->preserveImageColorProfiles;
$keepExifData = $config->preserveExifData;

$this->_image->smartResize(new Box($targetWidth, $targetHeight), $keepImageProfiles, $keepExifData, $this->_quality);
} else {
$this->_image->resize(new Box($targetWidth,
$targetHeight), $this->_getResizeFilter());
$this->_image->resize(new Box($targetWidth, $targetHeight), $this->_getResizeFilter());
}

if (Craft::$app->getImages()->getIsImagick()) {
Expand Down

0 comments on commit 13a627c

Please sign in to comment.