Keresés

Hirdetés

Új hozzászólás Aktív témák

  • Speeedfire

    nagyúr

    válasz Tele von Zsinór #5010 üzenetére

    a te scriptedből kiindulva sikerült megoldani a gondot :K

    köszönöm a segítésget :R

    function img_resize( $tmpname, $size , $save_dir, $save_name, $maxisheight )
    {
    $save_dir .= ( substr($save_dir,-1) != "/") ? "/" : "";
    $gis = getimagesize($tmpname);
    $type = $gis[2];
    switch($type)
    {
    case "1": $imorig = imagecreatefromgif($tmpname); break;
    case "2": $imorig = imagecreatefromjpeg($tmpname);break;
    case "3": $imorig = imagecreatefrompng($tmpname); break;
    default: $imorig = imagecreatefromjpeg($tmpname);
    }

    $x = imagesx($imorig);
    $y = imagesy($imorig);

    if(($gis[0] <= $size) and ($gis[1] <= $maxisheight))
    {
    $aw = $x;
    $ah = $y;
    }

    elseif (($gis[1] >= $gis[0]) and ($size<$gis[0])) {
    $aw=ceil($size/$gis[1]*$gis[0]);
    $ah=$size;
    }
    elseif (($maxisheight<$gis[1]) and ($gis[0] >= $gis[1])) {
    $ah=ceil($maxisheight/$gis[0]*$gis[1]);
    $aw=$maxisheight;
    }

    $im = imagecreatetruecolor($aw,$ah);
    if (imagecopyresampled($im,$imorig , 0,0,0,0,$aw,$ah,$x,$y))
    if (imagejpeg($im, $save_dir.$save_name))
    return true;
    else
    return false;
    }

    Fotóim https://fb.com/toth.szabolcs.art || IG: http://instagram.com/_tothszabolcs_ || Weblapom http://szabolcs-toth.com

Új hozzászólás Aktív témák