Copied to clipboard

Flag this post as spam?

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


  • Andreas Fritz 2 posts 72 karma points
    Mar 25, 2020 @ 13:38
    Andreas Fritz
    0

    Use normal Image dimensions instead of EXIF dimensions in media

    Hi all,

    I am wondering why the image dimensions in the media library are not the dimensions from the uploaded image file. Instead of the "normal" dimensions, the EXIF dimensions are displayed. I read this in the following blog post:

    https://our.umbraco.com/forum/umbraco-7/using-umbraco-7/71384-incorrect-image-dimensions-when-uploading-to-media-content

    Therefore, there is a class called "ImageHelper.cs" which can be found here:

    https://github.com/umbraco/Umbraco-CMS/blob/7c4a189aa3cf583954defd9c43a3e55e325f2c3f/src/Umbraco.Core/Media/ImageHelper.cs

    The method "GetDimensions" does the job.

    Now my question: Can i override this "GetDimensions" method to get the "normal" image dimensions? (See the dimensions in the following screenshot) enter image description here Thank you in advance!

    Best regards, Andreas

  • Jason Elkin 38 posts 351 karma points MVP 3x c-trib
    Mar 26, 2020 @ 17:33
    Jason Elkin
    0

    Hi Andreas,

    Firstly, here's the rub - technically speaking the "normal" dimensions are the EXIF dimensions. If the EXIF data is wrong then it's a problem with the file itself - strictly speaking it doesn't meet the JPEG spec.

    With that in mind, you'd be better off stripping out the EXIF data (or making sure that it is "right") before uploading it to the site, otherwise you'll have this problem in other places too.

    You could strip EXIF data out or override it at upload using ImageProcessor but that would mean re-processing the image.

Please Sign in or register to post replies

Write your reply to:

Draft