diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ce70b58d..324255cca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * Added `Utils::getExtensionByMime()` and cleaned up `Utils::getMimeByExtension` + tests * Added a `cache.check.method: 'hash'` option in `system.yaml` that checks all files + dates inclusively * Include jQuery 3.x in the Grav assets + * Added the option to automatically fix orientation on images based on their Exif data, by enabling `system.images.auto_fix_orientation`. 1. [](#improved) * Add `batch()` function to Page Collection class * Added new `cache.redis.socket` setting that allow to pass a UNIX socket as redis server diff --git a/composer.json b/composer.json index 3054b7390..832587378 100644 --- a/composer.json +++ b/composer.json @@ -19,7 +19,7 @@ "filp/whoops": "~2.0", "matthiasmullie/minify": "^1.3", "monolog/monolog": "~1.0", - "gregwar/image": "~2.0", + "gregwar/image": "dev-master#72568cfbeb77515278f2ccb386fc344e874b7ae8", "donatj/phpuseragentparser": "~0.3", "pimple/pimple": "~3.0", "rockettheme/toolbox": "~1.0", diff --git a/system/blueprints/config/system.yaml b/system/blueprints/config/system.yaml index 8b9b5e789..a55c1e1de 100644 --- a/system/blueprints/config/system.yaml +++ b/system/blueprints/config/system.yaml @@ -852,7 +852,6 @@ form: '0755': '0755' '0775': '0775' - images.debug: type: toggle label: PLUGIN_ADMIN.IMAGES_DEBUG @@ -864,6 +863,17 @@ form: validate: type: bool + images.auto_fix_orientation: + type: toggle + label: PLUGIN_ADMIN.IMAGES_AUTO_FIX_ORIENTATION + help: PLUGIN_ADMIN.IMAGES_AUTO_FIX_ORIENTATION_HELP + highlight: 0 + options: + 1: PLUGIN_ADMIN.YES + 0: PLUGIN_ADMIN.NO + validate: + type: bool + media.upload_limit: type: text append: bytes diff --git a/system/config/system.yaml b/system/config/system.yaml index 6486522e8..54e4c4781 100644 --- a/system/config/system.yaml +++ b/system/config/system.yaml @@ -113,6 +113,7 @@ images: cache_all: false # Cache all image by default cache_perms: '0755' # MUST BE IN QUOTES!! Default cache folder perms. Usually '0755' or '0775' debug: false # Show an overlay over images indicating the pixel depth of the image when working with retina for example + auto_fix_orientation: false # Automatically fix the image orientation based on the Exif data media: enable_media_timestamp: false # Enable media timetsamps diff --git a/system/src/Grav/Common/Helpers/Excerpts.php b/system/src/Grav/Common/Helpers/Excerpts.php index 7d7bfb278..090dd1121 100644 --- a/system/src/Grav/Common/Helpers/Excerpts.php +++ b/system/src/Grav/Common/Helpers/Excerpts.php @@ -276,6 +276,10 @@ class Excerpts }, []); } + if (Grav::instance()['config']->get('system.images.auto_fix_orientation')) { + $actions[] = ['method' => 'fixOrientation', 'params' => '']; + } + // loop through actions for the image and call them foreach ($actions as $action) { $medium = call_user_func_array([$medium, $action['method']],