是否可以从非标准URL中加载Picasso中的图像

时间:2015-01-07 06:10:03

标签: android picasso

我正在尝试让Picasso使用非标准图片网址。

我目前正在通过以下方式实施此方法:

String url = "http://someexampledomain.com/gallery.php?action=photo&phid=213"

Picasso.with(viewGroup.getContext()).load(url).placeholder(R.drawable.default_avatar_circular).error(R.drawable.default_avatar_circular).into(holder.postPhoto);

上面的代码会导致加载错误的占位符图像。 (请注意,我提供的链接是虚拟链接。我无法提供实际链接,因为它是私有API)。

然而,以下工作:

String url = "http://img4.wikia.nocookie.net/__cb20100125172609/starwars/images/thumb/f/f3/Yoda_naturist.jpg/200px-Yoda_naturist.jpg."

Picasso.with(viewGroup.getContext()).load(url).placeholder(R.drawable.default_avatar_circular).error(R.drawable.default_avatar_circular).into(holder.postPhoto);

我没有更改任何其他内容,除了URL的格式。第一个网址在我的浏览器中运行。毕加索不支持第一种类型的URL吗?

1 个答案:

答案 0 :(得分:0)

经过一些来回,API dev和我意识到这可能是服务器端身份验证问题。经过一番调查后证明了这一点。

使用相应的身份验证凭据更改请求URL,导致图像通过Picasso成功加载。

我认为如果其他人遇到类似的问题我会在这里提及。