abr*_*ham 46
推特 具有 有一个很好的简单网址.
https://api.twitter.com/1/users/profile_image/abraham
它有像"?size = larger"这样的尺寸选项
您可以在鲜为人知的Twitter和TwitterAPI提示和技巧上阅读更多相关信息.
Twitter现在有文档作为GET用户/ profile_image /:screen_name.
更新:已从API的v1.1中删除对此方法的支持.今后推荐的做法是在您的服务/应用程序中本地GET/users/show和缓存profile_image_url.
Ada*_* V. 12
function get_big_profile_image($username, $size = '') {
$api_call = 'http://twitter.com/users/show/'.$username.'.json';
$results = json_decode(file_get_contents($api_call));
return str_replace('_normal', $size, $results->profile_image_url);
}
Run Code Online (Sandbox Code Playgroud)
get_big_profile_image('bobsaget','_ bigger')应该返回一个大头像:http://a1.twimg.com/profile_images/330305510/n229938150541_9850_bigger.jpg
get_big_profile_image('bobsaget')应该返回一个更大的图像:http://a1.twimg.com/profile_images/330305510/n229938150541_9850.jpg
以前的回答者提供了我想要链接到原始的twitter api doc页面的正确答案,所以你知道它实际上是一种正式的做事方式:
你需要指定 ?size=
Run Code Online (Sandbox Code Playgroud)http://api.twitter.com/1/users/profile_image/twitter.json?size=bigger http://api.twitter.com/1/users/profile_image/twitter.json?size=normal
http://dev.twitter.com/doc/get/users/profile_image/:screen_name
小智 5
如果这是现在已知的事情,请道歉,但我在搜索过程中没有看到它记录在案,包括官方的Twitter文档.
您可以添加?size = original作为参数,该参数将返回用户的原始上传图像.
所以:
http://api.twitter.com/1/users/profile_image/twitter.json?size=original