Kindersprüche-Galerie

/* Configuration Start */

$thumb_directory = 'wp-content/themes/twentyten/galleryimg3/thumbs';
$orig_directory = 'wp-content/themes/twentyten/galleryimg3/original';

$stage_width=700; // How big is the area the images are scattered on
$stage_height=500;

/* Configuration end */

$allowed_types=array('jpg','jpeg','gif','png');
$file_parts=array();
$ext='';
$title='';
$i=0;

/* Opening the thumbnail directory and looping through all the thumbs: */

$dir_handle = @opendir($thumb_directory) or die("There is an error with your image directory!");

$i=1;
while ($file = readdir($dir_handle))
{
/* Skipping the system files: */
if($file=='.' || $file == '..') continue;

$file_parts = explode('.',$file);
$ext = strtolower(array_pop($file_parts));

/* Using the file name (withouth the extension) as a image title: */
$title = implode('.',$file_parts);
$title = htmlspecialchars($title);

/* If the file extension is allowed: */
if(in_array($ext,$allowed_types))
{
/* Generating random values for the position and rotation: */
$left=rand(0,$stage_width);
$top=rand(0,400);
$rot = rand(-40,40);

/* Outputting each image: */

echo '

‘;
}
}

/* Closing the directory */
closedir($dir_handle);

?>