Просмотр поста

.
fanatos
Менделеев
#  !предпросмотр!
    $namefile = $adrfile['name'];
    $infile = "$adrfile[adres]/$namefile";
    if (!empty($_SESSION['razm'])) {
        $razm = $_SESSION['razm'];
    } else {
        $razm = 110;
    }
    $sizs = GetImageSize($infile);
    $width = $sizs[0];
    $height = $sizs[1];
    $quality = 100;
    $x_ratio = $razm / $width;
    $y_ratio = $razm / $height;
    if (($width <= $razm) && ($height <= $razm)) {
        $tn_width = $width;
        $tn_height = $height;
    } else if (($x_ratio * $height) < $razm) {
        $tn_height = ceil($x_ratio * $height);
        $tn_width = $razm;
    } else {
        $tn_width = ceil($y_ratio * $width);
        $tn_height = $razm;
    }


в view.php