$filename = $photo_dir.'/'.substr($atn, 4).'.jpg'; header('Content-type: image/jpeg'); $nw = 50; $nh = 50; $pw = 350; $ph = 437; $image_p = imagecreatetruecolor($nw, $nh); $image = imagecreatefromjpeg($filename); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $nw, $nh, $pw, $ph); imagejpeg($image_p, null, 100);