3 votes

Auto Auto Rotate

AutoAutoRotate

Dead simple image auto-rotation for Umbraco v8+

Automatically runs ImageProcessor's AutoRotate, for fire-and-forget mobile image uploads.

Many images, especially those produced by mobile devices, are landscape in terms of actual pixel data but have their orientation set by EXIF data. Generally speaking this is a good thing, but the default configuration for ImageProcessor in Umbraco is to strip out the EXIF data and ignore it before resizing.

A portrait image at full size will look fine in the browser (the browser reads the EXIF data and knows what to do) but once it's processed by ImageProcessor it gets flipped back round to landscape.

As ImageProcessor's AutoRotate is already enabled by default all we need to do to fix this is append &autrotate=true to the image URL, but that can be a bit of a faff to implement everywhere.

All this package does is hook into ImageProcessor's vaidation event and add autorotate=true to every request.

If the parameter already appears in the querystring, either true or false, then it will not override it.

Config

preserveExifMetaData must be set to false and the AutoRotate plugin must be enabled in /config/imageprocessor/processing.config. These are the defaults so it should work OOTB.

<processing preserveExifMetaData="false" metaDataMode="None" fixGamma="false" interceptAllRequests="false" allowCacheBuster="true">
...
<plugin name="AutoRotate" type="ImageProcessor.Web.Processors.AutoRotate, ImageProcessor.Web" enabled="true" />

Caching

Browser caching could be a problem

You didn't actually leave images published the wrong way up on the website like that... did you...?

The querystring itself is not modified so browsers that have cached the incorrectly rotated images will keep seeing them until their cache is cleared. Clearing your cache will fix this for you (and for the backoffice) but you'll need to take manual steps to change the image URL to fix this issue for any other previous visitors.

ImageProcessor caching will not be

As far as ImageProcessor is concerned the querystring has changed so it will re-process the image and cache the new one.

Screenshots

 Download package
version 1.1.0

NuGet install instructions for Umbraco 8.1.0-8.18.13

Install-Package Our.Umbraco.AutoAutoRotate

Package owner

Jason Elkin

Jason Elkin

Jason has 351 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions: 8.6.x, 8.1.x

Package Information

  • Package owner: Jason Elkin
  • Created: 21/08/2020
  • Current version 1.1.0
  • .NET version 4.7.2
  • License MIT
  • Downloads on Our: 210
  • Downloads on NuGet: 2.5K
  • Total downloads : 2.7K