PicasaWebScraper

Abstract

PicasaWebScraper integrates PicasaWeb public galleries into a post or page in WordPress 2.x or greater. Galleries are displayed within WordPress, but due to image handling in PicasaWeb, individual image links still go to PicasaWeb.

Purpose

The default file handling in WordPress is somewhat cumbersome and the integration between iPhoto and PicasaWeb (for my purposes) is extremely smooth. I like having galleries in PicasaWeb, but I wanted more than just a link to my PicasaWeb albums. I couldn't find any plugins that would put PicasaWeb galleries within a post or page, which is what I wanted to do.

Solution

PicasaWeb provides an RSS feed of all their galleries. Unfortunately, it was difficult to incorporate this RSS feed into a page or post. By utilizing Exec-PHP and the PicasaWeb RSS feeds, and by applying a little voodoo, I was able to write a plugin that accepts an RSS feed for a gallery and displays the gallery within WordPress. If that is the root gallery (i.e. the gallery of galleries), then the links will display the inner gallery and those links will send you to PicasaWeb for the individual image.

Demo

Not currently available.

Download:

PicasaWebScraper 1.1

WordPress Link: http://wordpress.org/extend/plugins/picasawebscraper/
Version: 1.1
Release Date: 08/28/2007
Requirements: WordPress 2.0 or greater, may work under older versions of WordPress Exec-PHP 3.3 or greater, may work under older versions of Exec-PHP
License: GNU General Public License Version 3
References: http://codex.wordpress.org/Function_Reference/fetch_rss http://bluesome.net/post/2005/08/18/50/
Installation: 1. Download, install, activate EXEC-PHP (http://bluesome.net/post/2005/08/18/50/)

2. Download PicasaWebScraper

3. Upload PicasaWebScraper.php to ~/wp_contents/plugins/

4. Activate PicasaWebScraper plugin

Usage: 1. Temporarily disable the visual editor: Users -> Your Profile -> uncheck "Use the visual editor when writing", click Update Profile

2. On the post or page that you'd like to add the Picasa Web Gallery to, click on the Code tab and add the following code: <?php getPicasaWebAlbum('http://path.to.your.picasa.web.feed'); ?>; 3. Save/Publish the post or page.

4. Enable the visual editor: Users -> Your Profile -> check "Use the visual editor when writing", click Update Profile

v1.1: You can now provide an additional parameter to specify whether or not you'd like Picasa links to open in a new window. Multiple language support has also been added.

getPicasaWebAlbum(string $feedURL [, boolean $showHeader [, string $secrets [, string $preHTML, string $postHTML [, boolean $newWindow]]]])

feedURL - Required. This is the URL of the base RSS feed that you'd like to include in your blog. To get this RSS feed URL, go to the gallery that you would like to include and click the RSS link. The URL in your browser's address bar is what you should pass to the function.

showHeader - Optional. Default: true. If true, show's album title and link to PicasaWeb

secrets - Optional. Default: ''. Comma separated list of the gallery names (i.e. http://picasaweb.google.com/username/THISPARTOFTHEURL) that you would like to hide from display. Example: If you have two galleries that you'd like to hide and their URLs are http://picasaweb.google.com/username/gallery1 and http://picasaweb.google.com/username/someothergallery, then you would pass 'gallery1,someothergallery' as the parameter.

preHTML - Optional. Default: '<div>'. Allows styling of each item in the RSS feed; this needs to compliment the postHTML value.

postHTML - Optional. Default: '</div>'. Allows styling of each item in the RSS feed; this needs to compliment the preHTML value.

newWindow (Added in 1.1) - Optional. Default: false. Allows specification of whether or not Picasa links open in a new window.

Uninstallation: To remove PicasaWebScraper, not that you would ever want to, simply follow these instructions:

1. Temporarily disable the visual editor: Users -> Your Profile -> uncheck "Use the visual editor when writing", click Update Profile

2. Edit the posts containing the call: <?php getPicasaWebAlbum('http://path.to.your.picasa.web.feed'); ?>; and delete the code

3. Save the post or page

4. Enable the visual editor: Users -> Your Profile -> check "Use the visual editor when writing", click Update Profile

5. Deactivate the PicasaWebScraper plugin

6. Delete picasawebscraper.php from ~/wp_contents/plugins/

Roadmap

Initially, I would like to rework the plugin to avoid having to utilize the Exec-PHP plugin. While this is a great plugin that I vastly appreciate, it does require an extra step to install and it opens potential security holes.

Change Log

1.1 10/13/2007 Added support for multiple languages.Added optional parameter newWindow to support opening Picasa links in a new window.

Questions/Support

If you have any questions, please post a comment to this page and I will do my best to answer it or perhaps someone else can as well.

Archive

Comments

Hello!

I really like your plugin, exactly what I was searching for. Thank you for this!

Installation and using is really simple - works great...

..except for one small thing:

As you can see my blog is german and so is my Picasa.

Till now no problem as there is a parameter in the Picasa RSS link (hl=de), and it works for the gallery (http://kai.scharwies.de/fotos/galerie/). But when you click on an album it switches to english ("Number of Comments on Photo" instead of "Anzahl der Fotos im Album" for example).

Of course this is only a small thing, but I think it is also only a small change in the code to fix it.

Maybe you or anyone has an idea.

Best regards,

Kai

Kai,

Thank you very much for the feedback. As you can see, I've updated the plugin to support alternative languages and new windows for Picasa links. I hope this helps. Please let me know if there are any other improvements you'd like to see.

Kenny

I have a problem; I have a wordpress recently instaled on a server and installed the plugin, but it only shows me a warning message such this:

Warning: array_slice() [function.array-slice]: The first argument should be an array in ~\wp-content\plugins\PicasaWebScraper\PicasaWebScraper.php on line 105

This gallery is empty.;

could you help me?

thx

Never mind Kenny

I've learned to read now. :) I didn't see the requirements for the PHP enabler-plugin.... Sorry

Hey Kenny -

Seems we are both having the same problem.

Plugin works great until you drill down through an album and get to the actual photo.

I get the following error:

Warning: array_slice() expects parameter 1 to be array, null given in /home/funktio3/public_html/onepeggenius/wp-content/plugins/PicasaWebScraper.php on line 105

This gallery is empty.

You get this error:

Warning: array_slice() [function.array-slice]: The first argument should be an array in /home/content/k/e/n/kennycarlile/html/kcnet/wp-content/plugins/PicasaWebScraper.php on line 105

This gallery is empty.

Any way you know to overcome this???

Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Refresh Type the characters you see in this picture. Type the characters you see in the picture; if you can't read them, submit the form and a new image will be generated. Not case sensitive.  Switch to audio verification.