小编Man*_*uri的帖子

上传时默认情况下正在旋转图像

我正在尝试拍照并使用Samsung S7将其上传到我的应用程序中.但是上传时图像正在旋转.即使我也从图库中选择图像,它也会在上传时旋转.有什么我们可以从jquery代码修复.请建议.提前致谢

HTML:

<div class="photo-div" id="photo">
                <img id="uploadimage" src="" hidden="">
            </div>

<label id="files-label" for="files" class=" myprofile-btn-bold">Replace Image</label>
<input id="files" style="display:none;" type="file" accept="image/*" onchange="readURL(this);">
Run Code Online (Sandbox Code Playgroud)

jQuery的:

function readURL(input) {

    if (input.files && input.files[0]) {
        var reader = new FileReader();

        reader.onload = function (e) {
            $('#files-label').html('Replace Image');
            $('.photo-image').removeClass('photo-image');
            $('#uploadimage').attr('src', e.target.result);
            $("#headshot-message").hide();
            $("#headshot-cancel").hide();
            $('#noimage-label').addClass('hidden');
        }

        reader.readAsDataURL(input.files[0]);
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript css jquery samsung-mobile

10
推荐指数
1
解决办法
1万
查看次数

标签 统计

css ×1

javascript ×1

jquery ×1

samsung-mobile ×1