Código PHP:
   global $dirthumb;
  $path = getcwd();
  $pathtodir = substr(substr($path,0,-1),0,strrpos($path,"\\"));
  $files = array();
  if ($handle = opendir($pathtodir.$dirthumb)) {
   while (false !== ($file = readdir($handle))) {
    if ($file != "." && $file != "..") {
     if (eregi("\.jpe?g$", $file) || eregi("\.gif$", $file) || eregi("\.png$", $file)){
      $files[] = $file;
     }
    }
   }
   closedir($handle);
  }
  sort($files);
  foreach ($files as $image) {
   if(file_exists($pathtodir.$dirthumb.$image)){
    $size = getimagesize($pathtodir.$dirthumb.$image);
    $width  = $size[0];
    $height = $size[1];
    $im = imagecreatefromjpeg($pathtodir.$dirthumb.$image);
    $img = imagecreatetruecolor($width,$height);
    imagejpeg($im, $pathtodir.$dirthumb.$image, 100);
    imagedestroy($im);
   }
  } 
    Salu2
 
  
 


