毕加索图书馆今天停止使用Facebook图形图片链接工作 [英] Picasso library stopped working today with facebook graph picture links

查看:113
本文介绍了毕加索图书馆今天停止使用Facebook图形图片链接工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用中,我使用毕加索库从网址中加载图片. 这是一个很好工作且易于导入和使用的库,只需执行我需要的操作即可.

In my app i use Picasso library to load images from urls. It is a nicely working easily importable and usable library, and just do the thing i need.

但是,今天它停止工作了,而不是在开发时就停止了对已编译的apk的工作.

However, today it stopped working, and not while developping it is stopped working on a compiled apk.

因此,在我搜索并搜索了原因之后,我才发现了这辆马车东西:

So after i searched and searched for the reason i just found this buggy thing:

我使用Facebook图形网址加载个人资料图片.

I use facebook graph urls to load profile pictures.

这里是一个像: 个人资料图片

该链接实际上是" http://graph.facebook.com/1464090949/picture?type=large "

但是它重定向到: https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/572518_1464090949_1222130273_n.jpg

当然,这两个URL调用都可以在浏览器中运行,并且您可以看到个人资料图片.

Of course, both of url calls working in a browser, and you can see the profile picture.

但是,当我同时使用毕加索测试两个链接时:

However when i test both links with Picasso:

    ImageView iv = (ImageView)findViewById(R.id.imageView1);

    //Url1 NOT working, loads nothing.
    String url1 = "http://graph.facebook.com/1464090949/picture?type=large";

    //Url2 is the same as URL1, i just copied it from a browser, and this is working
    String url2 = "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/572518_1464090949_1222130273_n.jpg";


    Picasso.with(this).load(url2).into(iv);

因此,结论是,facebook可能有所更改,从现在起,毕加索无法从图形中加载图像.

So the conclusion is, facebook maybe changed something and from now on Picasso cannot load images from graph.

有人可以建议我做些什么吗? 当然,我可以尝试不同的库,但是如果有其他方法,我会很高兴.

Anybody can suggest me something to make this work? Of course i can try different libraries but if there is an other way i would be really happy.

推荐答案

解决方法1:

从http更改为 https .

工作: https://graph.facebook.com/1464090949/picture?type=large

不起作用: http://graph.facebook.com/1464090949/picture?type=large

解决方法2:

主题上找到了解决方案

Found soulution on this topic.

例如,如果您想要: http://graph.facebook.com/1464090949/picture?type=large

If you want for example: http://graph.facebook.com/1464090949/picture?type=large

您可以使用的个人资料照片:

This profile picture you could use:

https://graph.facebook.com/1464090949/?fields = picture.type(large)

哪个返回JSON对象:

Which returns a JSON Object:

   {
   "id": "1464090949",
   "picture": {
      "data": {
         "url": "https://fbcdn-profile-a.akamaihd.net/hprofile-ak-prn1/t5.0-1/572518_1464090949_1222130273_n.jpg",
         "is_silhouette": false
      }
   }
}

和田田!在那里. url的密钥是可用于加载图像的重定向url.

And tada! There it is. url's key is the redirected url you can use to load your images.

(这将需要我未测试过的oAuth ,只需坚持使用替代方法1)

(This will need oAuth which i didnt tested, just stick with Workaround1)

这篇关于毕加索图书馆今天停止使用Facebook图形图片链接工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆