$height) { $nw = 200; $nh = (int)($height/($width/200)); } else { $nh = 200; $nw = (int)($width/($height/200)); } /* * 2000 * 1800 * $nw = 200 * $mul = $height/$width/200 */ error_log("neww = $nw, $nh"); $thumb = imagecreatetruecolor($nw, $nh); imagecopyresized($thumb, $src, 0, 0, 0, 0, $nw, $nh, $width, $height); imagejpeg($thumb); } else { header("Status: 404 Not Found"); } return; } else { // show a grid of images ?>