$sh) { $dw = $w; $dh = round($sh * $w / $sw); } else { $dh = $h; $dw = round($sw * $h / $sh); } $thumb = imagecreatetruecolor($dw, $dh); imagecopyresampled($thumb, $im, 0, 0, 0, 0, $dw, $dh, $sw, $sh); } else { $thumb = imagecreatetruecolor($w, $h); $col = imagecolorallocate($thumb, 191, 191, 191); imagefill($thumb, 1, 1, $col); $col = imagecolorallocate($thumb, 10, 0, 0); $text_color=null; imagestring($thumb, 2, 35, 50, 'PHOTO NOT FOUND', $text_color); } imagejpeg($thumb); ?>