How to get "bigger-size" user image with Twitter API 1.1?

user2674354 picture user2674354 · Jan 31, 2014 · Viewed 22.2k times · Source

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.

Answer

simon_smiley picture simon_smiley · Dec 19, 2014

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"