=$h_src) { $ratio = $w_src/$max_width; } else { $ratio = $h_src/$max_height; } $width=floor($w_src/$ratio); $height=floor($h_src/$ratio); $image_temp=@imagecreatefromjpeg ($rand_image_ssylka); $res_image = imagecreatetruecolor($width, $height); imagecopyresampled($res_image,$image_temp,0,0,0,0,$width, $height,$w_src,$h_src); Header("Content-type: image/jpeg"); imagejpeg($res_image); imagedestroy($res_image); imagedestroy($image_temp); } } ?>