Gallery2 Picasa XML Import Hack

Gallery2 Picasa XML Import Hack

I have always been a fan of the Gallery program. You can see my pictures here

. I have also sporadically used Picasa2 from Google. While I thought Picasa2 was a nice free product, I never really had much use for it. However recently a few new features in Picasa2 have gotten my attention.

Notably Picasa2 allows for an XML export of an album, this export can even be directly uploaded by FTP to a web server. (Tools->Expiremental->Publish via FTP . . . then select XML as the page type). Then I found out that one of the modules available for gallery2 allows for a direct import of Picasa2 XML pages. Picasa Module. I tried it out and it worked as promised.

However, I found one error. If you do not enter a caption Picassa will automatically copy the
itemName into the itemCaption field. Personally if I don’t enter a
caption on a photo, I would prefer it remain un-captioned. So I hacked the module to fix this issue.

To prevent
captions from being duplicates of the itemName simply modify the code
as described below:
Edit GALLERYROOT/modules/picasa/classes/Picasa2DataParser.class at line 211.

           $albumArray['images'][$i]['caption'] = $imageArray[$i]['itemCaption'];

and Replace with:

           if ($imageArray[$i]['itemName'] == $imageArray[$i]['itemCaption']){
$albumArray['images'][$i]['caption'] == '';
} else {
$albumArray['images'][$i]['caption'] = $imageArray[$i]['itemCaption'];

One thought on “Gallery2 Picasa XML Import Hack

Leave a Reply

Your email address will not be published. Required fields are marked *