简体   繁体   English

从iOS中的网址加载后将图片旋转90度?

[英]image rotated 90 degree after loaded from url in iOS?

I have an UIImageView .I am loading image on that imageview from a url.Now after image is loaded it gets roatated 90 degree.When i open image url on webbrowser then it works fine.Please sugesst how can i remove this issue.I am using below code for it 我有一个UIImageView 。我正在从一个URL加载该图像视图上的图像。现在加载图像后它会旋转90度。当我在webbrowser上打开图像url时它可以正常工作。请建议如何解决此问题。使用下面的代码

  imageView.sd_setImage(with: URL(string: url), placeholderImage:UIImage(named:"image_icon"))

Note:I am using sdwebimage for loading image from url 注意:我正在使用sdwebimage从url加载图像

Your image is carrying EXIF data. 您的图片带有EXIF数据。 I guess you are getting data to upload using UIImageJPEGRepresentation which includes orientation information. 我想您正在使用UIImageJPEGRepresentation(包括方向信息)来上传数据。 Try using UIImagePNGRepresentation because png images does not carry orientation information. 尝试使用UIImagePNGRepresentation,因为png图像不包含方向信息。 I had the same problem earlier. 我之前也遇到过同样的问题。 Try and reply if works. 尝试并回答是否可行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM