Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • ThomasBrunbjerg 90 posts 182 karma points
    Oct 04, 2017 @ 12:00
    ThomasBrunbjerg
    0

    Images uploaded with image cropper are being auto-rotated

    Whenever I upload an image using the image cropper, there is a chance some of the are being rotated to landscape if they are in portrait.

    If I upload an image with dimensions: 3024x4032, it gets auto-rotated to landscape, which I don't want.

    What can I do to disable this behavior?

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    Oct 04, 2017 @ 19:41
    Marc Goodson
    0

    Hi Thomas

    I wonder if the underlying EXIF data for the image is indicating it's a landscape image.

    Umbraco uses Image Processor, which has an AutoRotate option:

    http://imageprocessor.org/imageprocessor/imagefactory/autorotate/

    Which seems to hint that if Exif preservation is set to preserve metadata that the AutoRotate won't change the images rotation.

    In Config/ImageProcessor/processing.config

    https://github.com/umbraco/Umbraco-CMS/blob/eef8d2111214d05b017d31ec365c78abb2ceb559/src/Umbraco.Web.UI/config/imageprocessor/processing.config

    preserveExifMetaData seems to be set to true and AutoRotate is also enabled.

    So you could try toggling one of those on and off to see if it gives you the desired behaviour for your uploaded image.

    If not there is a plugin for the backoffice that enables you to rotate an image that has an incorrect orientation:

    https://our.umbraco.org/projects/backoffice-extensions/tooorangeyuspinmerightround/

    regards

    Marc

  • ThomasBrunbjerg 90 posts 182 karma points
    Oct 05, 2017 @ 06:16
    ThomasBrunbjerg
    0

    Hi Marc

    Thank you very much for your suggestions! I tried changing the values for preserveExifMetaData and AutoRotate, ut that didn't seem to have any effect.

    I then downloaded your package, but I can't use it with the image cropper in the content section, the images remain in landscape mode. I can rotate the images in the media section just fine. Is there a way to use it with the image cropper property editor, while in the content section?

  • Marc Goodson 2155 posts 14406 karma points MVP 9x c-trib
    Oct 05, 2017 @ 08:12
    Marc Goodson
    0

    Hi Thomas

    Hmm, when you changed the settings, did you give the site an app pool recycle in between each combination you tried, just to be sure the new settings were applied.

    Interested if it is just one image you have that is misbehaving in terms of orientation, or all images in your install?

    And if you upload via the media section, is the same orientation problem occurring. (just wondering if it's something with the media picker that you have put together - or whether this happens with the core stuff?)

    I haven't tried combining the rotating option in the content section - you can see the source of the plugin here:

    https://github.com/marcemarc/uSpinMeRightRound/tree/master/Solution/uSpinMeRightRound/App_Plugins/tooorangey.uSpinMeRightRound

    (blog post here: http://tooorangey.co.uk/posts/to-everything-turn-turn-turn/)

    So you can see it's kind of similar pattern to the crops in the content section, in that an overlay is fired (from custom menu item in media section, but could be from a button in a property editor) and this overlay presents the rotate options, and then the change in orientation is saved back into the FileSystem using the current FileSystemProvider.

    But I'd try to get to the bottom of why that image, or images are always orientated incorrectly first, because if it's all of them, that's not common behaviour.

  • ThomasBrunbjerg 90 posts 182 karma points
    Oct 05, 2017 @ 08:30
    ThomasBrunbjerg
    0

    Hi Marc

    How do i perform an app pool recycle of my site? When I apply my changes, I simply save, change the web.config and rebuild.

    All my images, except a few, with the portrait rotation are misbehaving. They all come from the same source. My landscape images work just fine.

    When I upload the image to the media section, the same thing happens. I don't use a media picker in my project, only the image cropper.

    I could try to add the rotate option to the image cropper in the content section using your source code.

    I also tried wiping the EXIF data off the images and then uploading them, but to no effect. I've really no clue why this happens.

  • Simon Dingley 1474 posts 3431 karma points c-trib
    Jan 30, 2018 @ 10:01
    Simon Dingley
    1

    I've been investigating this issue over the past day as I have a customer with a travel blog that is experiencing rotated images even though they corrected the orientation before uploading them. I found that the affected images were taken on an iPhone (revealed by the EXIF data) and the issue was only apparent when viewing the blog posts on an Apple device or on my desktop in Chrome when viewing the image directly via it's url.

    I tried updating my config to set preserveExifMetaData="false" and <plugin name="AutoRotate" type="ImageProcessor.Web.Processors.AutoRotate, ImageProcessor.Web" enabled="true" /> with no joy however I have just found that adding autorotate=true to the image url does correct the orientation again. This is odd as the name of the plugin to me suggests "auto" means it should perform the correction without the need for the querystring key/value. Will ask James Jackson-South if he can input on this thread with some additional detail.

    I am surprised I've never come across this before.

  • John Bergman 483 posts 1132 karma points
    Jan 30, 2018 @ 15:28
    John Bergman
    0

    We actually decided to rotate the uploaded files (non-backoffice uploads) ourselves prior to storing them in the media.

Please Sign in or register to post replies

Write your reply to:

Draft