tristanojbacon
tristanojbacon

Reputation: 456

Linking to current Twitter profile picture and username on a website

I'd like to add a section to my website that shows the social media profiles I manage.

Instead of updating some HTML each time the profile picture or username changes, I'd like it to stay in sync, so to speak. Is there a simple way to link to the profiles information, without download individual widgets and somehow modifying them?

Thanks

Upvotes: 0

Views: 472

Answers (1)

user1921
user1921

Reputation:

You'd have to write the code, but have you checked the various network's Javascript APIs? They all seem quite simple.

Twitter: https://dev.twitter.com/docs/anywhere/welcome

Facebook: https://developers.facebook.com/docs/reference/javascript/

LinkedIn: http://developer.linkedin.com/javascript

Tumblr: http://www.tumblr.com/docs/en/api/v2

Google+: http://code.google.com/apis/libraries/

This particular example from the twitter api seems to be what you would need:

<span id="twitter-connect-placeholder"></span>
<script type="text/javascript">

  twttr.anywhere(function (T) {

    var currentUser,
        screenName,
        profileImage,
        profileImageTag;

    if (T.isConnected()) {
      currentUser = T.currentUser;
      screenName = currentUser.data('screen_name');
      profileImage = currentUser.data('profile_image_url');
      profileImageTag = "<img src='" + profileImage + "'/>";
      $('#twitter-connect-placeholder').append("Logged in as " + profileImageTag + " " + screenName);
    } else {
      T("#twitter-connect-placeholder").connectButton();
    };

  });

</script>

Based on your comments you may just want to direct link this way:

https://api.twitter.com/1/users/profile_image?screen_name=twitterapi&size=bigger

Upvotes: 1

Related Questions