SPIURL – Static Profile Image Urls for Twitter

I love the Twitter service and its API, but there are times when a few workarounds are necessary.  Currently, whenever a Twitter user changes his or her profile picture, the link to the picture changes, breaking the old link.  This can occur several times a day for many users (not to name any names – @pprlisa, @mediaphyter…).  For external developers, this can be quite a problem.  We either have to cache the images through our services, or perform constant lookups against Twitter (not good for the API).

Twitter is aware of the issue and I hope they’ll eventually rollout static profile image links.  In the meantime, I’ve developed a solution that anyone can use.  Developers can either code against my service or download the code and implement it themselves.

SPIURL is a Google App Engine project that stores the current profile image url in the Google datastore, keyed by screen name.  If the profile image url for a user changes, the datastore will update automatically.

You can easily reference an image using the following syntax:

http://purl.org/net/spiurl/{screen_name}

In an application, you can use a SPIURL link as an image source:

<img src="http://purl.org/net/spiurl/{screen_name}" alt="Twitter User" />

Pros:

- I’m using a permanent url at purl.org to reduce the direct dependence on Google.  If something happens and I have to move off of Google or I need to hand it off to another developer, the links can still work.

- It’s simple.  No need to make an API call to get the current image.  Just use the link and it will update on its own.

 

Cons:

- You’re relying on some guy (me) to make sure this thing works. (Although I don’t think I’ll need to make any additional code changes.)

- Something might go wrong – Perhaps I’ll hit a Google datastore or bandwidth limit.  (not likely, but it’s a risk).

- It’s slower.  Yes, it takes a few extra beats for the images to display vs. a direct call to Amazon.  The more images you display on a page, the more obvious the delay.  I have it running on My Tweeple and I think the performance is fine.

 

If you don’t want to rely on SPIURL, you can always download the code and implement your own version.  It’s entirely up to you.

While it’s true that Twitter might rollout this feature next week and this would all be for naught, I don’t mind.  Code is Poetry and Programming is Fun.  Enjoy.

  • Share/Bookmark

15 Comments so far »

  1. swhitley (Shannon Whitley) said,

    Wrote on January 28, 2009 @ 4:15 pm

    Twitter Comment


    Twitter Devs: Static Profile Image Urls [update] – [link to post] – Now with more geeky goodness baked right in.

    – Posted using Chat Catcher

  2. kr8tr (Rob La Gesse) said,

    Wrote on January 28, 2009 @ 4:21 pm

    Twitter Comment


    Retweet @swhitley: Twitter Devs: Static Profile Image Urls [update] – [link to post] – Now with more geeky goodness baked right in.

    – Posted using Chat Catcher

  3. TwitLinksRSS (TwitLinksRSS) said,

    Wrote on January 28, 2009 @ 4:42 pm

    Twitter Comment


    SPIURL – Static Profile Image Urls for Twitter | Shannon Whitley: I love the Twitter service and its API, but th.. [link to post]

    – Posted using Chat Catcher

  4. TweetingBird (Tweeting Bird) said,

    Wrote on January 28, 2009 @ 9:00 pm

    Twitter Comment


    SPIURL – Static Profile Image Urls for Twitter | Shannon Whitley [link to post]

    – Posted using Chat Catcher

  5. HuMBush (Heather M Bush) said,

    Wrote on February 17, 2009 @ 9:15 am

    Twitter Comment


    @swhitley Thanx!! I’ve been probing your site [link to post] ~ wondering how I could have missed that!! =}

    – Posted using Chat Catcher

  6. Online Aspect » Blog Archive » Permanent links to profile pictures on twitter said,

    Wrote on February 27, 2009 @ 8:14 pm

    [...] that Shannon Whitley started that provides a simple solution for the roaming profile picture.

  7. VirtualLee (Barbara McMillen) said,

    Wrote on March 12, 2009 @ 3:19 am

    Twitter Comment


    [link to post] re: photo

    – Posted using Chat Catcher

  8. Arik said,

    Wrote on April 6, 2009 @ 10:20 am

    SPIURL is brilliant and sure saves me a lot of work at Topify, so just wanted to say a big THANK YOU !

  9. Social Approach said,

    Wrote on July 17, 2009 @ 3:36 pm

    Shannon – Giant thanks for the service. It rocks! We’ve been noticing lately that some users are having old profile images from months ago coming back from SPIURL – Any ideas?

  10. tom said,

    Wrote on January 9, 2010 @ 9:53 am

    Wow! Thank you so much for doing this :D

  11. Lawrence Barriner II said,

    Wrote on March 30, 2010 @ 1:24 pm

    Sweet stuff. Thanks a whole lot for this. Made my life 10x easier.

  12. 0815 said,

    Wrote on April 6, 2010 @ 3:54 am

    SPIURL did not work wit buddypress chat.
    header error

  13. Flash Builder 4でSocial Spring Graph « kwLog said,

    Wrote on April 19, 2010 @ 8:00 am

    [...] twitter APIを経由していないため、profileアイコンが取得できていなかった。仮に実装するとしてもSocialGraph APIから取得できた一人ひとりのprofileをtwitter APIへリクエストするのはあまりにも無駄なので以下のtwitterアカウントからprofile画像のurlにリダイレクトしてくるGAEなサービスを拝借。 http://www.voiceoftech.com/swhitley/?p=652 [...]

  14. Lee Carter said,

    Wrote on May 27, 2010 @ 3:26 am

    I’m so thankful for this post! We’ve been looking to incorporate Twitter more into the site and this info is just what the doctor ordered!

    Thanks! :)

  15. Mohamed Meligy said,

    Wrote on July 25, 2010 @ 3:28 am

    This is super handy. Thanks a lot!

Comment RSS · TrackBack URI

Leave a Comment

Name: (Required)

E-mail: (Required)

Website:

Comment:

Twitter Users!
Enter your personal information in the form or sign in with your Twitter account by clicking the button below.