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:
Now my question: Can i override this "GetDimensions" method to get the "normal" image dimensions? (See the dimensions in the following screenshot)
Thank you in advance!
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.
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) Thank you in advance!
Best regards, Andreas
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.
is working on a reply...