Images rotate after ImageJob but don't want to

I have a problem with rotating some images while processing ImageJob.

I have a problem determining the correct rotation of an image downloaded from some (modern) mobile devices.

Images come from the iPad mini and Galaxy S5. I take portrait shots, but they change after loading and resizing. If I take a landscape photo, processing works fine.

I tried to use the auto answer plugin, but that does not seem to matter.

The code is basic and works on some images, but not on others, as indicated above.

HttpPostedFileBase file = base.Request.Files["photo"]; ImageResizer.ImageJob i = new ImageResizer.ImageJob(file, "~/OrigFiles/" + cvm.Id + ".<ext>", new ImageResizer.Instructions("width=768;height=1024;format=jpg;mode=max;autorotate=true;")); i.CreateParentDirectory = true; i.Build(); 

I sent a photo from the phone to my laptop, uploaded it, and it worked fine, which is strange. Could this be a download problem from a mobile browser? The problem occurs on iOS Safari and Chrome on new devices. The strange thing is that portraits work on older Nexus 7s of the first generation.

Further notes

Here is the diagnosis:

 You are using plugins from the Creative Edition: DiskCache (Performance Edition), WatermarkPlugin (Creative Edition) Registered plugins: ImageResizer.Plugins.Basic.DefaultEncoder ImageResizer.Plugins.Basic.NoCache ImageResizer.Plugins.Basic.ClientCache ImageResizer.Plugins.Basic.Diagnostic ImageResizer.Plugins.Basic.SizeLimiting ImageResizer.Plugins.MvcRoutingShim.MvcRoutingShimPlugin ImageResizer.Plugins.DiskCache.DiskCache ImageResizer.Plugins.Watermark.WatermarkPlugin ImageResizer.Plugins.Basic.AutoRotate Configuration: <resizer> <plugins> <add name="MvcRoutingShim" /> <add name="DiskCache" /> <add name="Watermark" /> <add name="AutoRotate" /> </plugins> <watermarks> <otherimages path="~/watermarks" right="20" bottom="20" width="20" height="20" /> <group name="portraitBG"> <image path="~/PORTRAIT.png" imageQuery="" top="0" left="0" /> <text text="#{name}" vertical="false" align="center" top="818" fontSize="60" color="FFF" /> </group> <group name="landscapeBG"> <image path="~/LANDSCAPE.png" imageQuery="" top="0" left="0" /> <text text="#{name}" vertical="false" left="50" top="650" fontSize="60" color="FFF" /> </group> </watermarks> </resizer> 

Sample image

Here is an example image: Sample image

https://github.com/recurser/exif-orientation-examples/blob/master/Portrait_8.jpg

When I download a sample image and download it from my laptop, it works like a portrait. When I download it and download from the phone (Samsung S5 Running 4.4.2), it does not work and saves the landscape.

+7
source share

Source: https://habr.com/ru/post/981381/