Volley NetworkImageView没有显示某些网址,内容类型可能有误(Volley NetworkImageView not showing for some urls, content type maybe wrong)

我的应用程序使用Volley库中的NetworkIamgeView类来显示图像。 对于某些网址,图片显示不正确。 我注意到这些链接指向png文件,但内容类型是image / jpeg。 这是问题的原因吗?

HTTP://baseurl/Standard1280x720.jpg/jcr:内容/引渡/ cq5dam.thumbnail.744.415.png

但是,这些链接都在Android手机上的浏览器应用中正确呈现。 有一些简单的修复来处理这个问题吗?

谢谢雷

My app uses the NetworkIamgeView class in the Volley library to show the images. For some urls the images are not shown correctly. I noticed that these links point to png files, however the content type is image/jpeg. Is that the cause of the problem?

http://baseurl/Standard1280x720.jpg/jcr:content/renditions/cq5dam.thumbnail.744.415.png

However these links are all rendered correctly on the browser app on Android phones. Are there some simple fixes to handle this?

Thanks Ray

最满意答案

Q1:不,Volley在解析图像时不使用内容类型。 它将任务委托给BitmapFactory 。 这意味着它可以在不同的设备上以不同的方式工作,并且支持的格式也可以变化。

Q2:

有一些简单的修复来处理这个问题吗?

通过

对于某些网址,图片显示不正确

目前尚不清楚问题是什么。 我建议启用日志以查看从服务器收到的确切内容。 您也可以只扩展ImageRequest ,将其添加到队列并在那里记录字节。

Figured out the problem. Volley does not support redirection.Had to modify the library to handle http 301 results.

更多推荐