Twinkle from Tapulous is an iPhone Twitter application with a twist – it uses location information, to introduce local social networking, and supports photos, a great extension to the standard Twitter recipe.
Twinkle handles photographs by uploading them to Tapulous’ server, then appending a ‘snipurl’ to the Twitter message which points to a page displaying the image. That works fairly well, but wouldn’t it be nice to actually see images inline, when viewing Twitter posts?
Well, now you can, if you have a self-hosted Twitter post list. See my Twitter feed on the right for a demo (although there may not be a post there with an image).
[Update] The newest version of this code is available here, and now supports Twitpic.
If you’re a WordPress user, there’s very little to do – I’ve modified Ricardo González’s Twitter for WordPress plugin. Download it here: twitter+twinkle.zip . See the extra configuration options to turn it on and configure it.
Maybe Ricardo will include the functionality in the next official release.
For everyone else, a little PHP-wrangling is required. Grab the TwinkleImageUtil PHP class here: TwinkleImageUtil.class.php.zip
Include it in your twitter list source code, and use it as a filter for the message content. Something like:
$message = TwinkleImageUtil::processContent($message, $mysql_database_handle);
Some configuration is possible – see the header comments for more details.
The code will create a thumbnail of the image, and store it locally. It’ll also cache the results in a MySQL database for speed. It supports Lightbox, too – just supply the relevant flag to turn it on.
Thanks for use and expand my code (and share it) :)