Page 1 of 2

MYGallery & Mooshow RT Completed

Posted: Thu 15. Jun 2006, 16:58
by macmukka
-------- OK now updated, please see below for tutorial -------


I have "written" a new RT that calls MooShow, an excellent little JS/CSS gallery written by Stuart Eaton over at -> http://www.mooshow.eatpixels.com/

It's based on moo.fx, something I can reccomend -> http://moofx.mad4milk.net/

A LOT of the PHP in the {MOOSHOW} RT is based on PHP by stuart, so 90% of the credit to him.

The RT calls images from the MyGallery Mod and displays them using MooShow.

At present it only handles single albums:-
{MOOSHOW:album name:speed:fadespeed:topnav:overlayNav:dropshadow:captions:border:copyright:IPTC}

But if one of you lovely people can help me fix it, I will make it handle all albums, with links underneath the gallery.

The problem is that when the gallery loads it correctly loads the 1st image but refuses to load further images and just gets stuck. Have a look here, try clicking the numbers at the top of the page.
http://www.jamesryder.co.uk/clients/mooshow

Can anyone help?

TO get the RT "working" you will need to install:-

MyGallery MOD -> there are lots of topics out there devoted to getting this to work.
Download MooShow and Moo.fx. http://www.mooshow.eatpixels.com/ is a good place to start.

You will then need the following in frontend_render.

Code: Select all

<?php
//----------------------------------------------------------------------------------------------
// {MOOSHOW}
// AUTHOR:          James Ryder
// DESCRIPTION:    	Uses the excellent Mooshow slideshow extension by Stuart Eaton of eatpixels.com to show content from MyGallery 
//					extension.
// INSTALLATION:    Put the code in frontend_render (for example in a file called mooshow.php)
//                  Note: If the article content part contains replacement tags (for example {SITE}),
//                  they will not be replaced because code in frontend_render is executed after those
//                  replacement tags already have been processed. To fix, put the code in
//                  content.article.inc.php instead.
// USAGE:          {MOOSHOW:ALL or album name:speed:fadespeed:topnav:overlayNav:dropshadow:captions:border:copyright:IPTC}               
//----------------------------------------------------------------------------------------------

function mooshow($albumName,$speed,$fadespeed,$topnav,$overlay,$dropshad,$captions,$border,$copy,$IPTC,$db) {

   if ($albumName == 'ALL' ) // alternate sql searches for when $albumName is ALL or Album Name;
  { 
    	  $sql = "SELECT * FROM `phpwcms_gal_albums` WHERE `pic_count` >'0' order by album_order ASC"; // Query for all Albums
	
  } else {  
  $sql = "SELECT * FROM `phpwcms_gal_albums` WHERE `title` = '".$albumName."'"; // Query for single Album
	}
  
   if($result = @mysql_query($sql, $db) or die ("<br><b>Error!</b><br>".mysql_error($db)) )
   {
  
   $num = mysql_num_rows($result);
   for ($i=0; $i <$num; $i++);
   {
   $row = mysql_fetch_assoc($result);
   $path = $imgpath.($row['id']);
   $output = getImageNames($row['id'],$row['title']);
    }

 }
$path = $row['id'];
$show = $row['title'];
$show = str_replace(" ", "", $show);
 $output .= "<script type=\"text/javascript\" src=\"mooshow/mooshow.1.04.js\"></script>";
 $output .= "<!-- mooShow html STARTS here : mooShow is by Stuart Eaton of eatpixels.com-->
	<div id=\"".$show."\" class=\"mooshow\">
		this.speed='".$speed."';
		this.fadeSpeed='".$fadespeed."';
		this.topNav='".$topnav."';
		this.overlayNav='".$overlay."';
		this.dropShadow='".$dropshad."';
		this.captions='".$captions."';
		this.border='".$border."';
		this.copyright='".$copy."';
		this.IPTCinfo='".$IPTC."'
	</div>
<!-- mooShow html ENDS here -->
<p><br /></p>";

// create the navigation for multiple albums if present

$num = mysql_num_rows($result);
if ($num > 1) {
   $first = ($row['title']);
   $first = str_replace(" ", "", $first);
   
   for ($i=0; $i <$num; $i++);
   {
   $row = mysql_fetch_assoc($result);
 	$show = $row['title'];
	$show = str_replace(" ", "", $show);
     $output .= "<a href=\"#".$i."\" onclick=\"mooShows['".$first."'].switchContent('".$show."');\">".$row['title']." Album </a> \n";
     
    }
}

 return $output;
  }

function getImageNames($path, $galleryName) {
$imgpath = "include/inc_module/mygallery/images/";
$galleryName = str_replace(" ", "", $galleryName);
$output = "<script type=\"text/javascript\">var showsIE = new Array(\"".$galleryName."\");</script>
		<script> var ".$galleryName." = new Array( "; //var showsIE is for the benefit of IE 5.5
  $path = $imgpath.$path;
  $files = array();
   $fileNames = array();
   $i = 0;
   
   if (is_dir($path)) {
       if ($dh = opendir($path)) {
           while (($file = readdir($dh)) !== false) {
               if ($file == "." || $file == ".." || $file == ".DS_Store" || $file == "thumbs.db" || strstr($file,'thumb_')) continue;
               $fullpath = $path . "/" . $file;
               $fkey = strtolower($file);
               while (array_key_exists($fkey,$fileNames)) $fkey .= " ";
               $a = stat($fullpath);
               $files[$fkey]['size'] = $a['size'];
               if ($a['size'] == 0) $files[$fkey]['sizetext'] = "-";
               else if ($a['size'] > 1024) $files[$fkey]['sizetext'] = (ceil($a['size']/1024*100)/100) . " K";
               else if ($a['size'] > 1024*1024) $files[$fkey]['sizetext'] = (ceil($a['size']/(1024*1024)*100)/100) . " Mb";
               else $files[$fkey]['sizetext'] = $a['size'] . " bytes";
               $files[$fkey]['name'] = $file;
               $files[$fkey]['type'] = filetype($fullpath);
               $fileNames[$i++] = $fkey;
           }
           closedir($dh);
       } else die ("Cannot open directory:  $path");
   } else die ("Path is not a directory:  $path");
   sort($fileNames,SORT_STRING);
   $sortedFiles = array();
   $i = 0;
   foreach($fileNames as $f) $sortedFiles[$i++] = $files[$f];
         
   foreach ($sortedFiles as $file) {
   	
	// get image sizes 
	list($width, $height, $type, $attr) = getimagesize("$path/$file[name]", &$info);
	$size = $file[sizetext];
	$iptc = iptcparse($info["APP13"]);
	// iptc  info
	$iptc = iptcparse($info["APP13"]);
	$title = $iptc['2#005'][0];
	$description = $iptc['2#120'][0];
	$description = str_replace("\r", "<br/>", $description);
	$description = addslashes($description);
	
	$keywords = $iptc['2#025'][0];
	$author = $iptc['2#080'][0];
	$copyright = $iptc['2#116'][0];
	
	$output .= "new Array('$path/$file[name]', '$width', '$height', '$size', '$title', '$author', '$copyright', '$description'), \n";
	}
	$output .="new Array('', '') \n";
	$output .="); \n";
	$output .="</script> \n";
	return $output;
	
	}

// -------------------------------------------------------------
  $content["all"] = preg_replace('/\{MOOSHOW:(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?)\}/ie', 'mooshow("$1","$2","$3","$4","$5","$6","$7","$8","$9","$10",$db);', $content["all"]);
// -------------------------------------------------------------

?>
That's all I have to say so far! Can anyone help?

I dont have much time to answer questions, but should be able to find some time if someone can help - ;-)

Thanks - Mac

PS. My PHP is VERY bad, 1st time and all that - :oops:

Posted: Tue 20. Jun 2006, 16:35
by macmukka
I have now solved all the problems--

Except the multiple galleries which I am going to implement later today hopefully.

Take a look at

http://www.jamesryder.co.uk/clients/mooshow

it will give you some idea of what can be achieved. The whole slide show is used using content from my gallery and a single RT. You can control all elements of the slideshow using CSS and all speeds and display elements (ie. copyrwrite information form the RT)

If anyone is interested I will write some comprehensive instructions - I have more time now!!

Posted: Tue 20. Jun 2006, 17:03
by Ben
macmukka - What you've done is very cool! I think many people here would be interested in a tutorial.

Posted: Tue 20. Jun 2006, 17:24
by Kosse
Very nice one macmukka!
Works both in FF and IE yummy :)
Only thing: you need to install mygallery right? :( Would have been perfect with the image sessions from phpwcms, but that I KNOW is a pita ;)
Good job
Cheers

Posted: Tue 20. Jun 2006, 18:27
by macmukka
Thanks for the feedback!

Right - I think this calls for a tutorial.

I will try and post one tomorrow.

More on Wed...

Posted: Wed 21. Jun 2006, 11:59
by isac
good work macmukka :shock:

tutorial please, please!

Posted: Wed 21. Jun 2006, 12:31
by rushclub
interested to ;)

rush

Sorry!!

Posted: Thu 22. Jun 2006, 14:08
by macmukka
Sorry, I know I am taking my time.

Lots of work on and I am getting married in 3 weeks! Too much to do.

But I will try and get that tutorial online.

Also the World Cup keeps getting in the way of things.....

;-)

Re: Sorry!!

Posted: Thu 22. Jun 2006, 15:43
by Kosse
macmukka wrote:Sorry, I know I am taking my time.

Lots of work on and I am getting married in 3 weeks! Too much to do.

But I will try and get that tutorial online.

Also the World Cup keeps getting in the way of things.....

;-)
Then you must NOT work on this MOD before -at least- one 1/2 months.
Live your life and enjoy it, cms's can wait ... life cannot (and future spouse can't trust me ;)
Congratulations and take all your time! All best!

Cheers

Posted: Thu 29. Jun 2006, 17:10
by Ati
Hello,
Nice work, but are there any changings?
Have you written a tutorial ?
It would be nice if there would be some news :)

Thanks,

Ati

Posted: Thu 29. Jun 2006, 17:25
by Ben
Ati,

Did you not read macmukka's last post? He's getting married in two weeks from now. I agree with you Kosse.

Posted: Fri 30. Jun 2006, 01:52
by Ati
Sorry Ben, my mistake...

Image

Alle best

Mooshow RT Tutorial

Posted: Wed 5. Jul 2006, 13:12
by macmukka
OK Planning for the wedding going well, so I had time to write a tutorial.

PHPWCMS has helped me earned a few £'s in the past, so time to give something back!

First: Excuse the PHP it is badly written, badly documented and not very pretty. I will accept help!

Changes since first post:-

- The script now works with named or ALL albums. If you select to display ALL albums the script will provide links to the different albums. This has not be extensively tested and will prob have bugs.
- The script now takes paths from the database. So if you update/change MyGallery paths them mooshow.php does not need updating.
- Now supports captions from the database.
- It generally works.

Useage of the tag is either:-

{MOOSHOW:ALL:speed:fadespeed:topnav:overlayNav:dropshadow:captions:border:copyright:IPTC}
or
{MOOSHOW:albumname:speed:fadespeed:topnav:overlayNav:dropshadow:captions:border:copyright:IPTC}

Options are the following:-

1. Transition speed
2. Image fade speed
3. Show / hide numbered naviagtion (1|2|3 etc.)
4. Show / hide overlay naviagtion
5. Show / hide drop shadow
6. Show / hide captions
7. Adjust size of image border
8. Show / hide copyright information
9. Show / hide IPTC information

For more information see http://www.mooshow.eatpixels.com/

The whole look and feel of the slideshow is completely changable by editing mooshow.css - it's very adaptable.


Example:

http://www.jamesryder.co.uk/clients/mooshow

Ok I dont have much time in the coming weeks and will be back mid-August, so you're on your own until then. I may have time to answers questions, but have other pressing stuff ;-)

However I will check back to see whether people can get it working from my instructions and amend if neccessary.

Hope it's of some use.

Requirements

PHPWCMS installed - I know it works on 1.2.5 and 1.2.6
MyGallery Extension installed
Mooshow pack from mooshow.eatpixels.com
http://mooshow.eatpixels.com/downloads/mooshow.1.04.zip


Steps to take

1. I would make a clean install of PHPWCMS for testing

2. Save the following as mooshow.php and save it to phpwcms_template\inc_script\frontend_render

Code: Select all

<?php
//----------------------------------------------------------------------------------------------
// {MOOSHOW}
// AUTHOR:          James Ryder
// DESCRIPTION:    	Uses the excellent Mooshow slideshow extension by Stuart Eaton of eatpixels.com to show content from MyGallery 
//					extension. Portions of this code are © Stuart Eaton of eatpixels.com.
// INSTALLATION:    Put the code in frontend_render (for example in a file called mooshow.php)
//                  Note: If the article content part contains replacement tags (for example {SITE}),
//                  they will not be replaced because code in frontend_render is executed after those
//                  replacement tags already have been processed. To fix, put the code in
//                  content.article.inc.php instead.
// USAGE:          {MOOSHOW:ALL or album name:speed:fadespeed:topnav:overlayNav:dropshadow:captions:border:copyright:IPTC}               
//----------------------------------------------------------------------------------------------

function mooshow($albumName,$speed,$fadespeed,$topnav,$overlay,$dropshad,$captions,$border,$copy,$IPTC,$db) {

if ($albumName == 'ALL' ) // alternate sql searches for when $albumName is ALL or Album Name;
  { 
		$sql = "SELECT * FROM `phpwcms_gal_albums` WHERE `pic_count` >0 order by id ASC"; // Query for all Albums
	  
	  } else {  
  		
		$sql = "SELECT * FROM `phpwcms_gal_albums` WHERE `title` = '".$albumName."'"; // Query for single Album
  }
    
   if($result = @mysql_query($sql, $db) or die ("<br><b>Error!</b><br>".mysql_error($db)) )
   {
    
	$result = mysql_query($sql);
	
while(list($id,$album_order,$title,$discrip,$piccount)= mysql_fetch_row($result))
{
if ($galleryname == '')
{
$galleryname = str_replace(" ", "", $title);

}
$output .= getImageNames($id,$title,$db);   

} 
}

// add javascript for mooshow in body of HTML 
 $output .= "<script type=\"text/javascript\" src=\"mooshow/mooshow.1.04.js\"></script>";
 $output .= "<!-- mooShow html STARTS here : mooShow is by Stuart Eaton of eatpixels.com-->
	<div id=\"".$galleryname."\" class=\"mooshow\">
		this.speed=".$speed.";
		this.fadeSpeed=".$fadespeed.";
		this.topNav='".$topnav."';
		this.overlayNav='".$overlay."';
		this.dropShadow='".$dropshad."';
		this.captions='".$captions."';
		this.border=".$border.";
		this.copyright='".$copy."';
		this.IPTCinfo='".$IPTC."'
	</div>
<!-- mooShow html ENDS here -->
<p><br/></p>";

// create the navigation for multiple albums if present
$num = mysql_num_rows($result);
if ($num > 1) {
$output .="<div id=\"navhold\">";
$i = 1;
$result = mysql_query($sql);
while(list($id,$album_order,$title,$discrip,$piccount) = mysql_fetch_row($result))
{
$show = str_replace(" ", "", $title);
$output .= "<a href=\"#".$i."\" onclick=\"mooShows['".$galleryname."'].switchContent('".$show."');\" class=\"switch\">".$title."</a> \n";
if ($num <> $i) {
$output .=" | ";
}  
   $i++;
    }
$output .="</div>";	
 } 
    return $output;
  }

function getImageNames($id, $galleryName, $db) {
//get image paths from db
$sql = "SELECT * FROM `phpwcms_gal_config` WHERE `id` >0"; // Query for paths
if ($result = @mysql_query($sql, $db) or die ("<br><b>Error!</b><br>".mysql_error($db)) )
   {
    $result = mysql_query($sql);
	$row = mysql_fetch_assoc($result);
  	$path = $row['pathtoscript'].$row['imagedir']."/".$id;
	}

//start to build image arrays
$galleryName = str_replace(" ", "", $galleryName);
$output = "<script type=\"text/javascript\">var showsIE = new Array(\"".$galleryName."\");</script>
		<script type=\"text/javascript\"> var ".$galleryName." = new Array( "; //var showsIE is for the benefit of IE 5.5
  $files = array();
   $fileNames = array();
   $i = 0;
   
   if (is_dir($path)) {
       if ($dh = opendir($path)) {
           while (($file = readdir($dh)) !== false) {
               if ($file == "." || $file == ".." || $file == ".DS_Store" || $file == "Thumbs.db" || strstr($file,'thumb_')) continue;
               $fullpath = $path . "/" . $file;
               $fkey = strtolower($file);
               while (array_key_exists($fkey,$fileNames)) $fkey .= " ";
               $a = stat($fullpath);
               $files[$fkey]['size'] = $a['size'];
               if ($a['size'] == 0) $files[$fkey]['sizetext'] = "-";
               else if ($a['size'] > 1024) $files[$fkey]['sizetext'] = (ceil($a['size']/1024*100)/100) . " K";
               else if ($a['size'] > 1024*1024) $files[$fkey]['sizetext'] = (ceil($a['size']/(1024*1024)*100)/100) . " Mb";
               else $files[$fkey]['sizetext'] = $a['size'] . " bytes";
               $files[$fkey]['name'] = $file;
               $files[$fkey]['type'] = filetype($fullpath);
               $fileNames[$i++] = $fkey;
           }
           closedir($dh);
       } else die ("Cannot open directory:  $path");
   } else die ("Path is not a directory:  $path");
   sort($fileNames,SORT_STRING);
   $sortedFiles = array();
   $i = 0;
   foreach($fileNames as $f) $sortedFiles[$i++] = $files[$f];
         
   foreach ($sortedFiles as $file) {
   	
	// get image sizes 
	list($width, $height, $type, $attr) = getimagesize("$path/$file[name]", &$info);
	$size = $file[sizetext];
	$iptc = iptcparse($info["APP13"]);
	// iptc  info
	$iptc = iptcparse($info["APP13"]);
	$title = $iptc['2#005'][0];
	//$description = $iptc['2#120'][0];
	//$description = str_replace("\r", "<br/>", $description);
	//$description = addslashes($description);
	
	if ($captions = "no"){
	$image = substr($file[name], 0, (strpos($file[name], ".")) );
	$sql = "SELECT * FROM `phpwcms_gal_caption` WHERE `Album`=".$id." AND `picture`=".$image;
	if($result = @mysql_query($sql, $db) or die ("<br><b>Error!</b><br>".mysql_error($db)) )
   {
    $result = mysql_query($sql);
	$row = mysql_fetch_assoc($result);
	$description = $row['caption'];	

}
}
	$keywords = $iptc['2#025'][0];
	$author = $iptc['2#080'][0];
	$copyright = $iptc['2#116'][0];
	
	$output .= "new Array('$path/$file[name]', '$width', '$height', '$size', '$title', '$author', '$copyright', '$description'), \n";
	}
	$output .="new Array('', '') \n";
	$output .="); \n";
	$output .="</script> \n";
	return $output;
	
	}

// -------------------------------------------------------------
  $content["all"] = preg_replace('/\{MOOSHOW:(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?):(.*?)\}/ie', 'mooshow("$1","$2","$3","$4","$5","$6","$7","$8","$9","$10",$db);', $content["all"]);
// -------------------------------------------------------------

?>
3. Upload/Copy the mooshow files to a directory Called mooshow in the root of your phpwcms install.
The following files are needed in the directory. They may NOT be in the same folder when you unzip them from the download. So you may need to rearrange them.
Image


Download and replace mooshow.css in the mooshow directory with the one from my site:
http://www.jamesryder.co.uk/clients/moo ... ooshow.css
it just contains extra classes for links for album navigation.

4. Install MyGallery extension.
MyGallery Mod: http://www.multisource.be/docs/gallery_mod_v01.zip
(As far as I know that is the latest version.)

There are lots of problems encountered when installing.
Read the following threads for help:
http://www.phpwcms.de/forum/viewtopic.p ... ry&start=0

THERE IS no need to create the album, Gallery, picture as described on page 3 of the above article, UNLESS you want to use the MyGallery extension as described in the forum. If you just want to use Mooshow RT. There is no need.

5. Create an album in Modules. Add some images. Give them captions if you wish.

6. Next create a template. Call it Mooshow.
In the header section add

Code: Select all

<link rel="stylesheet" type="text/css" href="mooshow/mooshow.css" media="all" />
<script type="text/javascript" src="mooshow/prototype.lite.js"></script>
<script type="text/javascript" src="mooshow/moo.fx.js"></script>
<script type="text/javascript" src="mooshow/moo.fx.pack.js"></script>
Image


7. Ok, now we're getting somewhere.
Make sure the HOME structure uses the mooshow template. It should do.

Why dont we turn off the structure title at this point. make it look pretty:-

Image

Click hide.

Creat an article under home and add a plain text or HTML content part and add the following (a simple slideshow):-

Code: Select all

{MOOSHOW:ALL:500:500:yes:yes:yes:yes:20:no:yes}
Image

Image

8. Now take a look. You should have a mooshow slideshow driven from the album(s) you have created in MyGallery Module. If you have added captions they should now be shown under the images.

You should be there, have a play around with the RT. Stuart Eaton at Eat Pixels has written something very useful. and mooshow is donationware so I urge you all to put your hands in your pockets!

mooshow question

Posted: Fri 28. Jul 2006, 11:03
by epsout
Hello,

I'am not using WordPress but i have a mooshow related question, i'am trying to integrate it and i got the same error you described in your first post (first image ok but then nn navigation). Do you remember the way you solved this issue ?

Thanks.

Jean-Yves

Re: MYGallery & Mooshow RT Completed

Posted: Tue 5. Feb 2008, 10:27
by heliotrope
Where can I find these Mooshow files ???
this dl link seems to be inactive :