Posts tagged ‘rss’

Picasa web album slideshow – Development guide

I was looking for a application to embed slideshow using pictures from picase web album. I found some plugins which can be used in blog or myspace. Some of them uses the picasa slide show url opened in a iframe or div. Then you will have less control on the slideshow as it is controlled by the slideshow application of picasa. But I required more control on the images from picasa.

I was looking for some application which will fetch/store all the images for an album in picasa and create a slideshow with more control on the images. I found nothing thats suites my requirement. So I started to design an application of such kind. On the basis of functionality I sub devided it into two major part. First is fetch the image related information for an album and store it if required. Second is display the slideshow using those image information.

In picasa you can view the pictures as set or individual but you won’t get actual picture name or its location. So I found now simple way to get the pictures name and their location. While searching more for such option I found there is a RSS feed for each album. The RSS feed provides image names and its location details. It makes my job easier. Now objective became to process the RSS feed to get the image related information. For this purpose I used XML-RSS package from PEAR. Here is snapshot of the code I wrote to process the feed:

  1. <?php
  2. require_once "XML/RSS.php";
  3. //$FeedURL is the URL of the rss feed of an album in picasa
  4. $FeedURL = "http://picasaweb.google.com/data/feed/base/user/wce/albumid/5331321673727336541?alt=rss&kind=photo&hl=en_GB";
  5. $rss =& new XML_RSS($FeedURL);
  6. $rss->parse();
  7. $rssArray = $rss->getStructure();
  8. $PicasaDataArray = array();
  9. $InfoArray = array();
  10. for($C=0; $C<count ($rssArray); $C++)
  11. {
  12.    if($rssArray[$C][‘type’] == ‘item’)
  13.    {
  14.       $PicasaDataArray[] = array(
  15.                               ‘title’ => $rssArray[$C][‘title’],
  16.                               ‘image’ => $rssArray[$C][‘enclosures’][0][‘url’],
  17.                               ‘link’ => $rssArray[$C][‘link’],
  18.                               ‘description’ => $rssArray[$C][‘description’],
  19.                               );
  20.    }
  21.    elseif($rssArray[$C][‘type’] == ‘image’)
  22.    {
  23.       $AlbumTitle =  $rssArray[$C][‘title’];
  24.       $AlbumPicture =  $rssArray[$C][‘url’];
  25.       $CreateDate =  $MetaInfo[‘lastbuilddate’];
  26.    }
  27. }
  28. // this $PicasaDataArray contains all the picture related information of an album from picasa web.
  29. ?>

Continue reading ‘Picasa web album slideshow – Development guide’ »