Picasaembed: Embed and browse your Picasa Web Albums
30.11.2006
Yesterday evening I discovered that Google’s Picasa Web Albums have RSS feeds. This led me to a script in PHP5, which enables you to embed the thumbnails of a whole album in any site — you may even browse through them. The browsing is done with Ajax to give a fast experience but there is a fallback solution which works without javascript.
Multiple embedded albums per page are also supported.
The usage of Picasaembed is not limited to Wordpress — it’s designed as a standalone library.
Download
Example
You are just seeing an example. You may also check out the example (source code) which is provided with the script.
Installation
Let’s assume that you want Picasaembed in your Wordpress blog.
Copy the files to a new folder named picasaembed in Wordpress’ plugins folder and make sure that the webserver has write permission to the cache folder.
Just make sure that the prototype.js is loaded somewhere. You would add it to your header.php file.
<script type="text/javascript" src="/blog/wp-content/plugins/picasaembed/prototype-1.4.0.js"></script>
As Picasaembed requires a RSS-URL to display the album we need set up a custom field for our post. Let’s assume that we name it picasaembed_rss_url.
In the theme files index.php and single.php (which display the post) we have to add these lines before the the_content() tag to display the album:
<?php
$picasaembed = (get_post_meta($post->ID, 'picasaembed_rss_url', true)) ? get_post_meta($post->ID, 'picasaembed_rss_url', true) : false;
if ($picasaembed) {
require_once './wp-content/plugins/picasaembed/Picasaembed.php';
Picasaembed::$location = './wp-content/plugins/picasaembed/Picasaembed.php';
echo Picasaembed::getContainer($picasaembed);
}
?>
That’s it. Now everytime a post has the custom field picasaembed_rss_url the value will be used as a RSS-URL for Picasaembed. Happy time!
Uses
- PEAR XML_RSS for parsing the rss feed. (not included)
- PEAR Cache_Lite for caching the parsed rss feed. (not included)
- The prototype JavaScript Framework for the ajax browsing.
- PEAR HTML_Page2 — optional — for the example. (not included)
License
Released under the LGPL.





Dein Kommentar