0

I am uploading the image in file upload control on change event then image is automatically rotate see in preview tag in my asp.net mvc c# but I am upload the existing image upload it's good but I am click the image in iPhone then image are upload that time image is rotate. This below code is used for the preview image.

This is my file upload control

 <img id="PreviewImage" class="mb20" width="300" src="../@Url.Content(@Url.Content(Model.ProfileImage))" />                                        
  @Html.TextBoxFor(model => model.UserFileUpload, new { type = "file", onchange = "ShowVehicleImagePreview(this)" })

this is my function

function ShowVehicleImagePreview(input) {
    if (input.files && input.files[0]) {
        var readervehicle = new FileReader();
        readervehicle.onload = function (e) {
            $('#PreviewImage').prop('src', e.target.result).width(300);
        };
        readervehicle.readAsDataURL(input.files[0]);
    }
}

Any one have the idea about this issue?

tereško
  • 58,060
  • 25
  • 98
  • 150
coder
  • 39
  • 8

1 Answers1

1

Maybe the image file it self has orientation metadata and the iPhone show it to you as correctly rotated because it's correcting the image, maybe this answer can help:
How to rotate JPEG images based on the orientation metadata?

Community
  • 1
  • 1
Dabbas
  • 3,112
  • 7
  • 42
  • 75