$w){ $im_y = ImageSY($im); $new_x = $w; $new_y = (int)($new_x/($im_x/$im_y)); $new = ImageCreateTrueColor($new_x,$new_y); ImageCopyResampled ($new, $im, 0, 0, 0, 0, $new_x, $new_y, $im_x, $im_y); $im = $new; } if(!file_exists($tndir . $d . "/")){ mkdir($tndir . $d . "/",0775); } if(!file_exists($tndir . $d . "/" . $i . "/")){ mkdir($tndir . $d . "/" . $i . "/",0775); } ImageJPEG($im, $tndir . $d . "/" . $i . "/" . $w . ".jpg", 75); //chmod($tndir . $d . "/" . $i . "/" . $w . ".jpg",0777); } // end if !file_exists(thumbnail) header("Content-Type: image/jpeg"); $openit = $tndir . "$d/$i/$w" . ".jpg"; $fint=fopen($openit,"rb"); @fpassthru($fint); @fclose($fint); } else { echo $dir; ImageAbort(); } } else { echo "c"; ImageAbort(); }