Picasa albums in Lightbox

If you surf the web frequently then you must have heard the name of Google. If you don’t, then do not proceed, because this post may not have any worth to you. Google has many many great services. And among them, Picasa is a nice photo service provided by google. You can upload as many images as you can at picasa. All you need is a google id. Picasa is a free service. You can upload photos in different albums. You can also make you albums private and public.

So, some days ago I was trying to accessing my picasa albums using google picasa web api. I successfully accessed my public albums and see the images in those albums. So I thought to find some ways to make these photos visible by an Lightbox image album created in Javascript. After a day of work, I can successfully see my picasa albums through lighbox. If you want to see your own album, check this link. Next I am thinking to build this up as a widget to add to any website for its user’s personal use.

Strip all non alpha-numeric characters from a string

Last night I was working on a home project. I was trying to build a lightbox photo gallery from picasa image gallery feed using google api. When I trying to get all photo list by album name, then I found that, google strips all non alpha-numeric characters from the album name and capitalize the first character of each words in the album name. For example, I have an album named “Little angels (1)”. But in the album url, google wrote the name as “LittleAngels1″ (http://picasaweb.google.com/<my_user_name>/LittleAngels1). So I need to write a tiny function to take my actual album name and made it url ready as google. Here is the function:

<?php

function stripNonAlphaNumChars($dirtyStr)
{
$string = ucwords($dirtyStr); // capitalize the first characters of each word in the string
$patterns = ‘/[^a-zA-Z0-9]+/’; // reg. exp. for non alphanumeric characters
$replacements = ”; // replaced with empty string
$cleanStr = preg_replace($patterns, $replacements, $string); // return the clean string

return $cleanStr;
}

echo stripNonAlphaNumChars(‘The little angels (1)’);

// the output is: TheLittleAngels1

?>

Very large function huh ?!