===== SlideshowGallery ===== I've made a first version of the AjaxGallery using some minor Java Script techniques. I always wanted to have a gallery that offers a slideshow so I can quickly browse through the pictures of one gallery. Some time ago I stumbled about a really neat javascript that does just that but the list of image files was hardcoded into it. So I took this and extended it with php. I think this combination is really cool. ''I finally managed to get this Slideshow widget into the wiki without any need for popups like they were used in the last version. '' ===What it can do=== - Creates a table with thumbnails from any directory that contains image files (jpg, gif and png) - generates the thumbnails and saves them in a .thumbs directory - on click shows the ""SlideShow"" Widget right over the wiki page and sticks to the window (which basically means even if you scrolled down before you click a picture the position is fixed, so you might change the size and information underneath could still be read) - more than one gallery per page is possible slideshow script: - automatically zooms to the size of the image or to the size of the window (if the image is larger) - lets you click through the images manually or continues automatically after a few seconds (this is deactivated by default) - a title or additional text could be displayed dynamically with any picture (this is deactivated but if you're JavaScript-Experienced you can turn it on, just need to know where the text comes from ===What it can't do=== - doesn't work in IE 6 (or earlier) - no fallback for non-Ajax browsers (which might be good) ===planned features=== - close button inside the picture (like the two others) - any other ideas? === Demo === See it work on https://yodahome.de/wiki/SandBox === Prerequisites / Installation === Your server needs GD support for PHP installed for the thumbnails. Furthermore this extension depends on the ""JavaScript"" library called [[http://prototype.conio.net/ | Prototype]] and [[http://script.aculo.us | script.aculo.us]]. prototype.js, scriptaculous.js and the other .js files of the the script.aculo.us package need to be placed in a subdirectory scripts in the action directory. These two lines then need to be put into header.php: %%(javascript) %% All in all there should be these files on your wikka installation: wikka/actions gallery.php (you may choose another name for the action) grafx.php wikka/actions/scripts prototype.js ajax-slideshow.js net.js scriptaculous.js effects.js builder.js controls.js dragdrop.js effects.js slider.js Furthermore there are some images which I placed in a subdirectory images (I know, very creative). I've created a [[http://yodahome.de/home/slideshowgallery.zip | handy zip file]] that includes all the additional files but NOT the action itself (gallery.php, grafx.php and css styles are listed below). Of course you also need 'pictures to show' located in some separate directory. Including the action any wikka page: ""{{gallery dir="path/to/pictures/" id="1|2|3|4..."}}"" ''**IMPORTANT**: The id **MUST BE SET**. First time you use the action start with 1 and increase the number with any following usage per page.'' This should work in any Browser with basic ""JavaScript"". It's been tested sucessfully in Mozilla Firefox 1.5, Internet Explorer 7 (beta), Opera 8, Konqueror 3.5 and I think a friend of mine even tried it in Safari (probably latest version as of March 2006). On Opera 9 Beta the switches at the sides to go forward and backward do not appear and you can't go forward or backward. Apart from that it works. Any further experiences are much appreciated. The reason for putting some of the code in another file named grafx.php is that this way the necessary functions are included only once even if you include the action two or more times and so the functions don't bother each other. There's probably even a better or more object-oriented way to do that so feel free to improve it and post your changes. ===Some Source Code=== actions/gallery.php %%(php) photoDir['.$id.'] = "'.$dir.'"; photoArray['.$id.'] = new Array( // Source, Width, Height, Caption '; $files = GetFileList($dir); $count = 1; foreach ( $files as $filename ) { $size = getimagesize($dir.$filename); if ($count>=count($files)) { echo "new Array(\"".$filename."\", \"".$size[0]."\", \"".$size[1]."\", \"\")\n"; } else echo "new Array(\"".$filename."\", \"".$size[0]."\", \"".$size[1]."\", \"\"),\n"; $count=$count+1; } echo ' ); // Number of photos in this gallery photoNum = photoArray['.$id.'].length; '; $position = 0; $output .= "
"; foreach ( $files as $filename ) { $thumbname = "tn_".$filename; if ( true !== file_exists($thumbdir."/".$thumbname) ) { createthumb($dir,$filename); } $output .= "\n"; $position += 1; $counter += 1; if ( $position == "4" ) { $output .= ""; $position = 0; $output .= ""; } } $output .= ""; } $output .= "
"; print($output); ?> %% grafx.php %%(php) '; ?> %% These need to go to your Stylesheet (css/whatever.css) %%(css) #Container{ margin:10px auto; padding: 0; position:relative; width:100px; height:100px; background-color:#fff; border:3px solid #CECEB5; overflow:hidden } #LoadContainer{ height:25%; width:50%; position:absolute; top:40%; left:25%; text-align:center; z-index:1 } #PhotoContainer{ visibility:hidden } #CaptionBlock{ height:10px; width:10px; text-align:left; margin:0 auto } #Caption{ color:#333 } #License{ margin:0 auto; padding-top:10px; font-size:10px; color:#666; border-top:1px solid #CECEB5; width:50px; text-align:left; line-height:1.4em; } #LinkContainer{ display:none; position:absolute; top:0;left:0; height:50px; width:50px; z-index:100; background:url(../actions/images/slideshow/start.gif) 50% 50% no-repeat } #PrevLink{ z-index:100; position:absolute; top:0%; left:0%; height:50px; width:50%; display:block } #NextLink{ z-index:100; position:absolute; top:0%; left:50%; height:50px; width:50%; display:block } #PrevLink:hover,#NextLink:hover{ text-decoration:none } #PrevLink:hover{ background:transparent url(../actions/images/slideshow/prev_rounded_sidebar2.gif) left 50% no-repeat } #NextLink:hover{ background:transparent url(../actions/images/slideshow/next_rounded_sidebar2.gif) right 50% no-repeat } #PrevLink span,#NextLink span{ display:none } img{ border:none } p{ font-size:11px; padding:1em 0 } #Wrapper{ margin:0 auto; height:50px; width:100%; overflow:hidden; position:relative; background-color: #8D977E; } #Wrapper[id]{ display:table; position:static } #InnerWrapper{ position:absolute; top:50%; left:0; } #InnerWrapper[id]{ display:table-cell; vertical-align:middle; position:static } #OuterContainer{ position:relative; top:-50% } %% As usual, if you encounter any errors during usage or by reading the code please let me know. ---- CategoryUserContributions