缓存http://graph.facebook.com/[UID]/图片调用?
感谢 如何使用 facebook graph api 显示用户个人资料图片? 我发现我可以通过以下方式检索个人资料图片
http://graph.facebook.com/[UID]/picture
,但这会重定向到一个图像,例如:
http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_14868 35_q.jpg
我的第一个问题是,当我想显示此图像时,我应该这样做(从 API 返回)
<img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg" />
还是应该调用 api:
<img src="http://graph.facebook.com/alfredwesterveld/picture" />
http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg 显示我的更新的个人资料图片,如果更新我在 Facebook 上的个人资料图片或确实显示我的旧个人资料图片。我问这些问题是因为当我可以调用绝对 URL(立即解析为图像)时,我可以安全地进行重定向(往返)。我相信这可能会增加,特别是当我想从我的网站访问者那里获取所有个人资料图片时。
Thanks to How can I display the users profile pic using the facebook graph api? I found out I can retrieve profile picture via
http://graph.facebook.com/[UID]/picture
but this redirects to an image like for example:
http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg
My first question is when I want to display this image should I do(returned from API)
<img src="http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg" />
or should I call the api:
<img src="http://graph.facebook.com/alfredwesterveld/picture" />
Does http://profile.ak.fbcdn.net/hprofile-ak-snc4/hs1346.snc4/161671_1096373372_1486835_q.jpg show my updated profile picture, if update my profile picture on Facebook or does show my old profile picture. I ask these question because when I could call an absolute URL(which resolves to an image immediately) I could safe myself a redirect(round-trip). I believe this could add up especially when I want to get all profile pictures from the visitors of my website.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你好,为什么你不使用 fbml 标签呢?
编辑
您好,如果您想获取用户上传的照片,那么您可以通过此获取
用户上传的所有图像都可以轻松捕获
hi why you not use fbml tag for this?
EDIT
hello if you want to get photo uploaded by the user then you can get by this
All images uploaded by the user can be easily captured
当您想使用第二种方法显示用户的图片时,这是一个好的方法:
这样做您将确保每次您都会收到用户的更新图片(如果最近更改过)。
稍后编辑
与缓存问题相关,如果您想保存直接网址以改善图片缓存,我不建议这样做,因为每次用户更改个人资料时这些网址都会发生变化图片,因此您最终可能会显示旧图片,即使用户最近实际上更改了它。
When you want to display the picture of a user use the second method, that's the good one:
Doing like this you'll be sure that each time you'll receive the updated picture of the user, if it was changed recently.
later edit
Related to the cache issue, if you want to save the direct urls in order to improve caching of the pictures I don't suggest doing so because those urls are changing each time a user changes the profile picture, so you might end up displaying an older picture even though the user actually changed it recently.