User defined tag for picasa html albums..

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Post Reply
osnet

User defined tag for picasa html albums..

Post 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
Last edited by osnet on Thu Feb 01, 2007 8:47 pm, edited 1 time in total.
lepoticum

Re: User defined tag for picasa html albums..

Post 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.
Last edited by lepoticum on Tue Jul 31, 2007 1:46 pm, edited 1 time in total.
User avatar
Dr.CSS
Moderator
Moderator
Posts: 12711
Joined: Thu Mar 09, 2006 5:32 am

Re: User defined tag for picasa html albums..

Post 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
User avatar
Elijah Lofgren
Power Poster
Power Poster
Posts: 811
Joined: Mon Apr 24, 2006 1:01 am

Re: User defined tag for picasa html albums..

Post 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
Last edited by Anonymous on Thu Aug 02, 2007 7:39 pm, edited 1 time in total.
Note: I don't have time to take on any more projects. I'm quite busy. I may be too busy to reply to emails or messages. Thanks for your understanding. :)
Post Reply

Return to “Tips and Tricks”