Calling user profile image and resize it
I've got the following code which shows twitter user data in my system. My issue is with the profile picture, it's retrieved it from my db which I use it in another place with small size. I can't figure out how to adjust the field to take profile img from twitter itself and resize it in 200x200 px
<div class="profile">
<center><a href="http://www.twitter.com/<?=$fields[1]?>" class="text_bigger2"><?=$fields[2]?></a><br />@<a href="http://www.twitter.com/<?=$fields[1]?>"><?=$fields[1]?></a><br /><br /><a href="http://www.twitter.com/<?=$fields[1]?>" > <img height=110 src="<?=$fields[7]?>" /> </a></center>
<br/>
<center><a href="http://twitter.com/share" class="twitter-share-button" data-text="I'm ranked # <?=$fields[0]?> in Sudanesetweeps.com" data-via="SudaneseTweeps">Tweet</a></center>
</br>
<ul>
<li>I'm ranked # <span class="color"><?=$fields[0]?></span> in Sudanesetweeps.com</li>
<li><span class="color"><?=$fields[3]?></span> <?=$followers_diff?> Followers</li>
<li><span class="color"><?=$fields[4]?></span> <?=$tweets_diff?> 开发者_JAVA百科Tweets</li>
<li><?=$fields[5]?></li>
</ul>
</div>
Live demo is here http://www.sudanesetweeps.com/new/find.php?username=altayeb
You can specify the size for an image.
bigger - 73px by 73px normal - 48px by 48px mini - 24px by 24px original - undefined. This will be the size the image was originally uploaded in. The filesize of original images can be very big so use this parameter with caution. Example Values: bigger
Example Requests
GET http://api.twitter.com/1/users/profile_image/twitterapi.json
GET http://api.twitter.com/1/users/profile_image?screen_name=mobinga&size=bigger
^^ You should use the second example to get the image in the big format. Rename the screen name to your preferred choice.
API Doc
use this site : http://tweetimag.es/ this will help you get any twitter profile picture with the sizes available.
精彩评论