$tmp=split("/",$match); $file3 = end($tmp); $save = "./thu/${file3}.thumb.jpg"; if(!file_exists($save)) { $file2 = "${match}.jpg"; header('Content-type: image/jpeg') ; list($width, $height) = getimagesize("$file2") ; $gg = 100 / $width; $modwidth = $width * $gg; $modheight = $height * $gg; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file2) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; echo "file $save was created
"; }