In this article about using slideshows in wordpress I showed you how to embed slideshows in Wordpress blog posts and sidebars using the Google Ajax Feed API.
I prefer to use this facility to pull in Image feeds from Flickr.
The problem with the images in these feeds is that they’re either too large or too small.
The MediaRSS specification has a
The Google Ajax Feeds API tries to get around this by letting you specify a “thumbnailTag” in the slideshow options object. Basically, you set this to “content” to tell the API to look for the image in the “content” section of the feed, rather than the
So I wrote a simple PHP screen scraping utility which grabs the Flickr feed, and changes the ImageUrl…_L.jpg to ImageUrl….M.jpg – in other words, it modifies the feed to include the medium size image rather than the large size.
Medium sized images are fine for slideshows, and they load quite quickly.
Here’s the PHP code:
$first_var = "1";
foreach($_GET as $variable => $value)
if ($variable == 'uri')
$uri = $uri . $value;
$uri = $uri . "&" . $variable . "=" . $value;
header("Content-Type: application/xml; charset=ISO-8859-1");
$ch = curl_init() or die(curl_error());
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$data1=curl_exec($ch) or die(curl_error());
Just save this in a file named FlickrRSS.php in the top folder of your wordpress directory. Then instead of using your flickr RSS feed, pass the feed as a query parameter to the PHP utility.
You’ll need to change the <> tags in the file to <>.
So if your feed URL was this:
This will change the