ok il codice è qua sotto...
//pagina principale
if (is_dir($dir)){
if($dh = opendir($dir)){
$i=0;
$file_d = scandir($dir);
$count = count($file_d);
echo "i file sono: $count
";
for ($i=0 ; $i<$count;$i++){
$file = $file_d[$i];
if ($file != "." && $file != ".." && $file != $DIR_THUMBS) {
$dir_file = $dir.$file;

$exif = exif_read_data($dir_file, 0, 1, true);
$exif_filename = exif_read_data ($dir_file,'FILE' ,0 );
//lettura altri dati exif $q_foto_to_store = "INSERT INTO foto (name, aperture_f_number, make, model, orientation, width, length, exposure_time, iso_speed_ratings, date_and_time_original, date_and_time_digitized, exif_version) VALUES ('$name_file', '$aperture_f_number', '$make', '$model', '$orientation', '$width', '$length', '$exposure_time', '$iso_speed_ratings', '$date_and_time_original', '$date_and_time_digitized', '$exif_version')";
$r_foto_to_store = mysql_query($q_foto_to_store) or die(mysql_error());
$thumbs = $DIR_FOTO.$sel_dir."/".$DIR_THUMBS;
if (! is_dir($thumbs))
$err = mkdir($thumbs,0777);

$dir_to_store = $DIR_FOTO.$sel_dir."/";
$err = Resize($dir_to_store, $DIR_THUMBS, $name_file, $HEIGTH_NEW);
}
}
}closedir($dh);




//pagina dove sono contenute altre funzioni inclusa con un require_once

function Resize($dir_foto, $dir_thumbs, $name_file, $height_new){
ini_set("memory_limit", "128M");
ini_set("max_execution_time", 900 );

if (!function_exists("imagetypes")){
print "

La funzione imagetypes non esiste</p>";
return FALSE;
}

$image_file = $dir_foto.$name_file;
list($width,$height)= GetImageSize($image_file);
if ($width<$height){
$thumb_width = 100;
$ratio = 100 / $width;
$thumb_height = $height * $ratio;
}
else{
$thumb_height = 100;
$ratio = $thumb_height / $height;
$thumb_width = $width * $ratio;
}
$image_id=@ImageCreateFromJpeg($image_file);

$thumb_id=@ImageCreateTrueColor($thumb_width,$thum b_height);

ImageCopyResampled($thumb_id,$image_id,0,0,0,0,$th umb_width,$thumb_height,$width,$height);
$thumb_file = $dir_foto.$dir_thumbs."/".$name_file;

if (((substr($thumb_file,-3)=="jpg")||(substr($thumb_file,-3)=="JPG")) && (imageTypes() & IMG_JPG)) {
ImageJpeg($thumb_id,$thumb_file,100);
}
else {

imageDestroy($thumb_id);
imageDestroy($image_id);
return FALSE;
}
imageDestroy($thumb_id);
imageDestroy($image_id);
return TRUE;
}