Recently I released some code to discover and embed Twinkle images linked from Twitter postings, and released a modification to Ricardo González’s Twitter for WordPress plugin which uses it.
I’ve now implemented support for Twitpic as well.
Grab the modified WordPress plugin here:
twitter-for-wordpress-plus-images-v0.2.6.zip
After installation, add the widget and make sure ‘Discover images’ is ticked.
For non-Wordpress users, the base code is also available here:
TwitterImageUtil.class.php-v0.2.6.zip
Include it in your twitter list source code, and use it as a filter for the message content. Something like:
$message = TwitterImageUtil::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.
Updates
- Version 0.2.6: Bugfix for posts with both images and @mentions
- Version 0.2.5: Bugfix from prior version, plus compatibility fix for Twitpic changes
- Version 0.2.4: Updated to match Twitter for WordPress v1.9.2: Compatibility fix for WP 2.7
- Version 0.2.3: Another update, chasing the moving target that is Twitpic
- Version 0.2.2: Updated to match Twitpic’s new image storage using Amazon S3.
13 Comments
You’ve a bit of useless data in your zip file, see below;
Archive: twitter-for-wordpress-plus-images-v024.zip creating: twitter-for-wordpress/ inflating: twitter-for-wordpress/readme.txt creating: __MACOSX/ creating: __MACOSX/twitter-for-wordpress/ inflating: __MACOSX/twitter-for-wordpress/._readme.txt inflating: twitter-for-wordpress/twitter.php inflating: __MACOSX/twitter-for-wordpress/._twitter.php inflating: twitter-for-wordpress/TwitterImageUtil.class.php inflating: __MACOSX/twitter-for-wordpress/._TwitterImageUtil.class.php
may be an idea to clean it up, the osx folders&data aren’t needed.
Would also seem that the image discovery isn’t working for either twitpic or twinkle… take a look at http://luke.sheldrick.co.uk/blog/ the widget twitter #1, have just tried both types, and neither seem to ‘discover’ the images…
Could you let me know if it’s broken…?
Thanks for the heads-up, Luke – Twitpic and Twinkle change so often that it’s a real chore to keep up with them. There was also a bug that was introduced when integrating the latest version of Twitter for WordPress.
Both issues should be fixed now, and I zipped it on the command line to stop OS X putting in the control files it loves so much.
Hey,
Thanks for looking at the code… Seems to work now =] another few things I’ve noticed however…
-Twinkle pics, respect the lightbox flag, however are they supposed to be tiny when viewed in the lightbox, I would have thought a full size image would show?
-TwitPics, don’t respect the lightbox flag, and just take you to twitpic, is that the expected behaviour?
Cheers again
I know this is an insanely late reply (my apologies), but yep, this is correct behaviour: Unfortunately, the Twitpic image URL changes frequently (probably to avoid hot-linking), so we have to open the page. Twinkle's all good though.
Great idea but i've not seen it work in practice yet. I mostly post with tweetie for iphone and if you add a photo it uses twitpic. So is this ever going to work with twitpic or do they change their service too often?
Hi Michael,
That's a pain! It should be working with Twitpic, but as you say, they change things around so fast, I'm not really surprised it's fallen over again. I'll take another look at it soon.
Hey I played with it and got it to work. Had to change the code a bit and work in debug mode. I'll email u the fix tomorrow.
Hi guys ! As everyone, twitpic doesn't work for me… But, Michael Smith, if you've change the code and it's working, can u share with us right here ?
Thanks anyway for al your efforts !
Sorry about the delay, Jess; I've rolled in Michael's changes to the official version now, 0.2.5.
Thanks Michaels… But it doesn't seem to work on my own blog… But it's allright, it's allready a great plugin ;)
Hi Jess, You probably need to clear the cache – do it by opening the widget settings ('edit' on the widget), then saving (you may need to change a setting, then change it back later, I can't quite remember)
Hi Micheal,
the plugin is exactly what I’ve been looking for – I’m having to use a twitter widget and a twitpic widget in the sidebar and wanted to combine them. So this should be perfect.
Only snag is that it’s not recognising the twitpic images….
I know twitpic keep shifting things (and it’s also a while since the last update so maybe this has been put to bed) but are you planning a new update of can you recommend a solution or an alternative?
Thanks