Page 1 of 1

User defined tag for picasa html albums..

Posted: Thu Feb 01, 2007 8:44 pm
by osnet
I'm submitting this to the forge, so I can keep working on it. Works as-is though:

Picasa HTML Album Loader
Submitted Description: This script was meant to meet a need of my
own, to include a picasa html export into a cmsmadesimple content
page.

It reads the actualy html text file, taking only the content between
the tags, and also re-writes the anchor tags, so that the
album can be navigated.

Limitations:
- Not tested with frames, so the frames templates with picasa are not
appropriate for this.
- Uses file input, so the album has to be in the same file system as
your CMS installation.
- Ignores picasa stylesheet. You could attach it in the CMSMS pages
though.
- Does not resize images, so your template needs to be wide enough
for the largest image exported from picasa.


Code: Select all

$folder = urldecode($params['folder']);
$index = $params['index'];

if($_GET['file']){
	$filename = $_GET['file'];
}else{
	$filename=$folder.$index;
}

if(file_exists($filename)){

$url = $folder;
$output="";
$file = fopen($filename, "r");
$count = 0;

while(!feof($file)) {

    //read file line by line into variable
   $tmp = fgets($file, 4096);

   if(stripos($tmp,'</__body')!==false){		

		$num = strlen($tmp)-(stripos($tmp,'</__body')+stripos($tmp,'>',stripos($tmp,'</__body')));
		$neg = $num - ($num*2);		
		$output = substr($tmp,$neg);
		
	}elseif(stripos($tmp,'<__body>')!==false){
		$done=true;
	}else{
		if(($output !='')&&(!$done)) {
			$tmp = str_replace('src="','src="'.$url,$tmp);
			$page = $_GET['page'];
			$tmp = str_replace('<a href="','<a href="/index.php?page='.$page.'&file='.$url,$tmp);		
			$output = $output . $tmp;
			}
	}
  
	$count++;
 
}

fclose ($file);

echo $output;

}else{
 echo $filename.' not found.';
}
Here is a page making use of the script:

http://stephenhughes.ca/index.php?page=xmas-twins

Re: User defined tag for picasa html albums..

Posted: Tue Jul 31, 2007 1:44 pm
by lepoticum
sorry probably an obvious answer but can someone explain to me how to implement this code, i have the code inserted as a user defined tag in my my cms but what part do i edit to insert my "authkey" and link to the relevant picasa acount? thanks as always!

thanks for the code by the way, much appreciated.

Re: User defined tag for picasa html albums..

Posted: Thu Aug 02, 2007 6:50 pm
by Dr.CSS
I think it's meant to be used with the desktop Picasa program where you can make an HTML exported album to upload to your site, FTP, and then look thru it to find your album and make it appear on your page...

osnet...

There is and extra > greater than sign in the top...

Photos from xmas and twins being born 2007
   
        >

xmas&twins -- p1150030.jpg

Re: User defined tag for picasa html albums..

Posted: Thu Aug 02, 2007 7:33 pm
by Elijah Lofgren
There is a PHP script allowing embedding of Picasa Web Albums here: http://www.loloyd.com/blog/igs_picasaweb_api :)

I had planned to make it into a CMSMS module, but ended up not needing and I don't have time now. ;)

Hope this helps,

Elijah