In a mobile web application I am developing, users are allowed to take a picture with their camera and the camera image is uploaded to a server. The issue I am having is that on iOS devices, images get an EXIF Orientation tag associated with them such as "ROTATE 90 CW". This orientation tag causes the image to be displayed in an incorrect orientation when it is displayed. For example, if the user takes a picture of something with their iPhone in portrait orientation, the image appears to be rotated to landscape when viewed on the server. I want to correct this issue on the server-side using VB.Net so that I automatically detect the EXIF Orientation tag and if it is "ROTATE 90 CW" (or any other value that will make the image appear to be displayed incorrectly), then I want to automatically rotate the image to the correct orientation. In summary, I want the image on the server to appear exactly as it appeared when the user took the picture with their camera.
Can someone post the code that will do this? Thanks in advance.
For anyone who needs this, I basically resolved the issue using this code in VB.Net. I found this to be just what I needed:
For anyone interested... C# version.