Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

移动web,手机拍照上传(竖着拍),预览正常,但上传后的图片是横过来的(转了90°)。 #18

Open
sTrevor opened this issue Mar 27, 2018 · 9 comments

Comments

@sTrevor
Copy link

sTrevor commented Mar 27, 2018

如题,怎么处理该情景。

@devin87
Copy link
Owner

devin87 commented Mar 30, 2018

这个是图片显示问题,添加以下样式试试:
img {image-orientation: from-image;}

@sTrevor
Copy link
Author

sTrevor commented Mar 30, 2018

谢谢您回复。
我的新问题是ios手机拍照预览是正常,但上传到服务器中的图片是旋转90度的。

@sTrevor
Copy link
Author

sTrevor commented Mar 30, 2018

ios系统手机,拍照可以上传。而从照片图库选择的照片无法预览和上传,提示格式不正确。

@devin87
Copy link
Owner

devin87 commented Mar 30, 2018

你上传代码是怎么写的?格式是由你自己配置的,通过allows配置上传格式,通过scale配置图片缩放。

new Q.Uploader({
    url:"api/upload.ashx",

    target: element,    //上传按钮,可为数组 eg:[element1,element2]
    view: element,      //上传任务视图(若自己实现UI接口,则无需指定此参数)

    allows: ".jpg,.png,.gif,.bmp",

    //图片缩放
    scale: {
        //要缩放的图片格式
        types: ".jpg",
        //最大图片宽度(maxWidth)或高度(maxHeight)
        maxWidth: 1024
    }
});```

@devin87
Copy link
Owner

devin87 commented Mar 30, 2018

旋转和上传没关系,是你拍的照片就是旋转的,需要你自行处理。

@sTrevor
Copy link
Author

sTrevor commented Mar 30, 2018

谢谢,旋转我使用exif处理好了。

@sTrevor
Copy link
Author

sTrevor commented Mar 30, 2018

之前以为ios照片jpg格式,它实际是jpeg格式,已经解决了。

@wozywei
Copy link

wozywei commented Aug 2, 2019

手机端确实存在旋转的问题,我的是逆时针旋转90度,预览的时候就被旋转了,怎么解决?

@devin87
Copy link
Owner

devin87 commented Aug 2, 2019

@wozywei 参考上面的回复,如果只是显示就添加样式 img {image-orientation: from-image;} 试试;后台要处理的话就根据EXIF信息做修正。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants