'; // Set sortImagesByDate to true to sort by date. Otherwise files are sorted by filename. $sortImagesByDate = false; // Set sortInReverseOrder to true to sort images in reverse order. $sortInReverseOrder = true; // END OF OPTIONS // ----------------------- $output = ''; $output .= "Creating XML for Autoviewer.
"; $output .= "-------------------------------------------------

"; if ($sortImagesByDate){ $output .= "Sorting images by date.
"; }else{ $output .= "Sorting images by filename.
"; } if ($sortInReverseOrder){ $output .= "Sorting images in reverse order.

"; }else{ $output .= "Sorting images in forward order.

"; } //loop thru images $xml = ''.$options; $folder = opendir("resources/slideshow_images"); $i = 1; while($file = readdir($folder)) { if ($file[0] != "." && $file[0] != ".." && $file[0] != "Thumbs.db" ) { $files[$i] = $file; $i++; } } // now sort by date modified $numbers = array(); for($i = 1;$i<=count($files);$i++) $numbers[] = $i; shuffle($numbers); for($i=1; $i<=$actually_shown_autoviewer; $i++) { $key = $files[$numbers[$i]]; // Get the image dimensions. $dimensions = getimagesize('resources/slideshow_images/'.$key); $width = $dimensions[0]; $height = $dimensions[1]; $xml .= "\n\n"; $xml .= " resources/slideshow_images/".$key."\n"; $xml .= " \n"; $xml .= " ".$width."\n"; $xml .= " ".$height."\n"; $xml .= "\n"; $output .= "- Created Image Entry for: $key whose width is ".$width." and whose height is ".$height.".
"; } closedir($folder); $xml .= ''; //next line can cause erroneous warnings //chmod( 'gallery.xml', 0777 ); if (file_exists($file)) { unlink ($file); } $file = "resources/autoviewer_gallery.xml"; if (!$file_handle = fopen($file,"w")) { $output .= "
Cannot open XML document: $file
"; } elseif (!fwrite($file_handle, $xml)) { $output .= "
Cannot write to XML document: $file
"; }else{ $output .= "
Successfully created XML document: $file
"; } fclose($file_handle); //system('chmod 777 '.$file); ?> fkfoto.com | Florian Knorn Photography
Beyond photography I also offer web design, mobile app development, audio and video production services…
Find out more here!
logo

Florian Knorn Photography

AutoViewer requires JavaScript and the Flash Player. Get Flash here.

© 2013 by Florian Knorn