I'm trying to get last 5 tweets from a person. I did it, but profile picture is not looking normal, resolution is corrupted. like that. ! http://i.hizliresim.com/wLQEJZ.jpg
var $twitter = $('#twitter'); $.getJSON('http://www.demo.net/twitter.php?username=yeniceriozcan&count=5', function(data){ var total = data.length, i = 0; $twitter.html(''); // önce içindekini temizle sonra tweetleri yazdır. for ( i; i < total; i++ ){ var tweet = data[i].text; // tweet var date = parseTwitterDate(data[i].created_at); // tarih var image = data[i].user.profile_image_url; // profil resmi var url = 'https://twitter.com/' + data[i].user.screen_name +'/status/' + data[i].id_str; $twitter.append('<div class="tweet"><a target="_blank" href="' + url + '"><img src="' + image + '" alt="" class="profile-image" />' + tweet + '</a> <span class="tweet-date">(' + date + ')</span></div>'); } });
This is my code. I tried to that for to get profile picture,
var image = data[i].user.profile_image_url;
And also in other tweets file,
$tweets = $twitter->get('https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name='.$username.'&count='.$count); print json_encode($tweets);
I used this api.
but I can not view pictures in normal resolutions. How can I fix it? Thanks.
Photos can be up to 5MB; animated GIFs can be up to 5MB on mobile, and up to 15MB on web. We accept GIF, JPEG, and PNG files.
Twitter images sizes for in-stream photos: 1600 x 900 pixels (recommended) Maximum file size: Up to 5MB for photos and GIFs on mobile. Up to 15MB on the web.
Twitter is testing new changes to how photos and videos appear on its apps, closer to how images appear on other services such as Instagram. The new feature will expand visual media embedded in tweets to fill the whole width of a mobile phone's screen.
I found that using bigger still brought the picture back in a relatively small format. Using this answer enables you to resize the image allowing you to have a big image without distortion.
If you want to get the image full size just get rid of the "_normal" completely
http://pbs.twimg.com/profile_images/429221067630972918/ABLBUS9o_normal.jpeg
Goes to
http://pbs.twimg.com/profile_images/429221067630972918/ABLBUS9o.jpeg
Note: The urls in this answer are modified so as to not reflect my twitter details hence why entering them will give you a "no page exists"
When you read the url from data[i].user.profile_image_url, replace "_normal" with "_bigger". Here's the explanation from the Twitter docs:
User Profile Images and Banners
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With