=====Picasa Action===== >>==See also:== Documentation: PicasaActionInfo.>>This is the development page for the Picasa Action. You can now integrate a picasa web album into your wikka wiki. Check this site for an example: http://www.ucclimbing.com/w/Pictures .::c:: This action is a implementation of a JavaScript Picasa album integration. Original author is Dieter Raber and it has been adapted by Jeroen Diderik. License: http://www.gnu.org/copyleft/lesser.html You need a one-liner action file, called picasa.php and you just link to the javascript file below. %%(php) %% Copy the following code to a file called http://www.example.com/wikkadir/picasa.js (replace it with your wikka address and change your picasa username) %%(javascript) /* * @author Dieter Raber * @copyright 2004-12-27 * @version 1.0 * @license http://www.gnu.org/copyleft/lesser.html --------------------------------------------------------------------- * @adaptor Jeroen Diderik * @source http://www.jdee.nl/ * @copyright 2007-08-01 * @version 1.5 --------------------------------------------------------------------- * @adaptor RaffaR * @source http://wikkawiki.org/ * @copyright 2008-05-20 * @version 1.5wikka */ //User variables to set var photosize = 800; //return maximum size picture (see for supported format: http://code.google.com/apis/picasaweb/reference.html#Parameters) var thumbsize = 144; //size thumb /cropped(see for supported format: http://code.google.com/apis/picasaweb/reference.html#Parameters) var albumcols = 3; // distribute thumbs on main page over x collums var cols = 4; // distribute thumbs on albumphotos page over x collums var maxresults = 24; //maximum of pictures on albumphotos page var username = 'youruserid'; //userid function readGet(){ var _GET = new Array(); var uriStr = window.location.href.replace(/&/g, '&'); var paraArr, paraSplit; if(uriStr.indexOf('?') > -1){ var uriArr = uriStr.split('?');var paraStr = uriArr[1];}else{return _GET;} if(paraStr.indexOf('&') > -1){paraArr = paraStr.split('&');}else{paraArr = new Array(paraStr);} for(var i = 0; i < paraArr.length; i++){paraArr[i] = paraArr[i].indexOf('=') > -1 ? paraArr[i] : paraArr[i] + '=';paraSplit = paraArr[i].split('='); _GET[paraSplit[0]] = decodeURI(paraSplit[1].replace(/\+/g, ' '));} return _GET; }; var _GET = readGet(); if(!photosize){photosize = 512;} var si = _GET['si']; if(!si){si = 1}else{si=Number(si)}; function $(a){document.write(a);} function formatDate(dt){ var months = new Array(12);months[0] = "January";months[1] = "February";months[2] = "March";months[3] = "April";months[4] = "May";months[5] = "June";months[6] = "July";months[7] = "August";months[8] = "September";months[9] = "October";months[10] = "November";months[11] = "December"; var today = new Date(Number(dt)); var year = today.getYear(); if(year<1000){ year+=1900 }; return ( months[(today.getMonth())] + " " + today.getDate() + ", " + year); } function formatDateTime(dt){ var today = new Date(Number(dt)); var year = today.getYear(); if(year<1000){ year+=1900 }; return (today.getDate() + "-" + (today.getMonth()+1) + "-" + year + " " + today.getHours() + ":" + (today.getMinutes()<10 ? "0"+today.getMinutes() : today.getMinutes()) ); } function picasaweb(j){ //returns the list of all albums for the user $("
"); for(i=0;i"); $("
"+ j.feed.entry[i].title.$t +"
"/*+album_date+"    "*/+j.feed.entry[i].gphoto$numphotos.$t+" photos"); if (i % albumcols == (albumcols-1)) {$("
");} } $("
Albums

"); } function albums(j){ //returns all photos in a specific album //get the number of photos in the album var np = j.feed.openSearch$totalResults.$t; var loc = j.feed.gphoto$location.$t; var desc = j.feed.subtitle.$t; var album_date = formatDate(j.feed.gphoto$timestamp.$t); var item_plural = "s"; if (np == "1") { item_plural = ""; } var photoids = new Array(); var len = j.feed.entry.length; $("
"); $(""); for(i=0;i1){ ppage = "previous | " }; if((si+maxresults)next" }; var navRow = "" $(navRow); for(i=0;i0){ var prev = j.feed.entry[i-1].gphoto$id.$t; } if (i

"); $(/*""+photoDate+"*/"
"); if (i % cols == (cols-1)) {$("
");} } $(""); $(navRow); $("
<<< Albums > "+ j.feed.title.$t +"
"); $("

"+ j.feed.title.$t +"

"); $("
"+np+" photo"+item_plural+", "+album_date+", "+loc+"
"); $("
"+desc+"
"); $("

"); $("
" +ppage + "Page "; for(i=0;i<=pageCount;i++){ if(si == ((i*maxresults)+1)){ navRow += "["+(i+1)+"] "; }else{ navRow += ""+(i+1)+" " }; }; navRow += npage + "

"); } function photo(j){//returns exactly one photo var img_title = j.entry.title.$t; //get the dimensions of the photo we're grabbing; if it's smaller than our max width, there's no need to scale it up. var img_width = j.entry.media$group.media$content[0].width; var img_height = j.entry.media$group.media$content[0].height; var img_base = j.entry.media$group.media$content[0].url; var photo_id = _GET['photoid']; var album_id = _GET['albumid']; var my_next = _GET['next']; var my_prev = _GET['prev']; var my_photoids = _GET['photoids']; var my_numpics = _GET['np']; var my_galleryname = _GET['galleryname']; var my_fixed_galleryname = my_galleryname.slice(1, my_galleryname.length-1); var album_base_path = window.location.protocol + "//" + window.location.hostname+window.location.pathname +"?page="+_GET['page']+"&si="+si+"&albumid="+ _GET['albumid']; //Collect Exif info if available if(j.entry.exif$tags){ var photo_exif = ""; for(var exif in j.entry.exif$tags){ photo_exif += ""; } photo_exif += "

Exchangeable Image File Data (Exif)

"+exif.replace("exif$","")+": "+j.entry.exif$tags[exif].$t+"
"; } // Get the filename for display in the breadcrumbs var LastSlash = 0; var img_filename = img_title; var photo_array = my_photoids.split(","); //find preceding two and following two pictures in the array; used for the navigation arrows. //the arrows are already linked to the previous and next pics, which were passed in with the URL. //however, we need the ones that are two behind and two ahead so that we can pass that info along when we link to another photo. //"pretty sneaky, sis." for(i=0;i
<<< Albums > " + my_fixed_galleryname + " > " + img_filename + " (" + (current_index+si-1) + " of " + my_numpics + ")
"); if (p1 == null){ var prev = album_base_path } //we're at the first picture in the album; going back takes us to the album index if (n1 == null){ var next = album_base_path } //we're at the last picture in the album; going forward takes us to the album index //the navigation panel: back, home, and next. $("
previous album next

"); if (img_width < photosize){ display_width = img_width; } //don't scale up photos that are narrower than our max width; disable this to set all photos to max width //at long last, displayed the image and its description. photos larger than max_width are scaled down; smaller ones are left alone $("
"); $("
"+j.entry.media$group.media$description.$t+"
"); $("
"+photo_exif+"
"); } if(_GET['photoid']&&_GET['albumid']){ $('');//photo }else if(_GET['albumid']&&!_GET['photoid']){ $('');//albums }else{ $('');//picasaweb } //$Update: May 10, 2007$ //$Update: July 31, 2007, Jeroen Diderik$ //$Update: Januari 31, 2008, Jeroen Diderik$ //$Update: February 16, 2008, for ucclimbing.com, Frederic Gillardo$ //$Update: March 6, 2008, for ucclimbing.com, RaffaR, Fred. Gillardo$ //$Update: May 20, 2008, for wikkawiki.org, RaffaR$ %% Actually there is a newer version available: http://www.multiprof.nl/ but I didn't had a look at it yet. ---- CategoryDevelopmentActions