'; while ( ($file = readdir($handle)) !== false ) { $files[] = $file; } natsort($files); foreach ( $files as $file) { if ( !is_dir('images/'.$dir.'/'.$file) ) { $split = explode('images/'.$dir.'/', $file); $ext = $split[count($split) - 1]; if ( ($type = getPictureType($ext)) == '' ) { continue; } if ( ! is_dir('thumbs') ) { mkdir('thumbs'); } if ( ! file_exists('images/'.$dir.'/thumbs/'.$file) ) { if ( $type == 'jpg' ) { $src = imagecreatefromjpeg('images/'.$dir.'/'.$file); } else if ( $type == 'png' ) { $src = imagecreatefrompng('images/'.$dir.'/'.$file); } else if ( $type == 'gif' ) { $src = imagecreatefromgif('images/'.$dir.'/'.$file); } if ( ($oldW = imagesx($src)) < ($oldH = imagesy($src)) ) { $newW = $oldW * ($max_width / $oldH); $newH = $max_height; } else { $newW = $max_width; $newH = $oldH * ($max_height / $oldW); } $new = imagecreatetruecolor($newW, $newH); imagecopyresampled($new, $src, 0, 0, 0, 0, $newW, $newH, $oldW, $oldH); if ( $type == 'jpg' ) { imagejpeg($new, 'images/'.$dir.'/thumbs/'.$file); } else if ( $type == 'png' ) { imagepng($new, 'images/'.$dir.'/thumbs/'.$file); } else if ( $type == 'gif' ) { imagegif($new, 'images/'.$dir.'/thumbs/'.$file); } imagedestroy($new); imagedestroy($src); } echo "
  • "; echo ''.$file.''; echo '
    '; echo '
    '; echo 'DOWNLOAD'; echo '
    '; echo '
    '; echo '
    '.$description.'
    '; echo "
  • "; } } echo ''; } } ?>