Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

thumbnail dimension question

  • 01-11-2006 09:39AM
    #1
    Registered Users, Registered Users 2 Posts: 648 ✭✭✭


    hi
    id like it so as the image i upload is thumbnailed to max width 480 or max height 150...

    problem is that if i upload an image of this size it thumbnails the image to make the width 150.. which is not on at all
    does anyone know what i have to do to this code to make it work as i want??

    heres the cost that calculates the ratios


    $srcWidth = $imginfo[0];
    $srcHeight = $imginfo[1];

    # Generate new width/height
    $ratio = max($srcHeight,$srcWidth ) / 150;
    $ratio = max($ratio, 1.0);
    $destWidth = (int)($srcWidth / $ratio);
    $destHeight = (int)($srcHeight / $ratio);


    Tnx


Comments

  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    I use something like this
    $height = $size[1];
    $width = $size[0];
    if ($height > 480)
    {
    $height = 480;
    $percent = ($size[1] / $height);
    $width = ($size[0] / $percent);
    }
    else if ($width > 150)
    {
    $width = 150;
    $percent = ($size[0] / $width);
    $height = ($size[1] / $percent);
    }
    


  • Registered Users, Registered Users 2 Posts: 648 ✭✭✭ChicoMendez


    Tnx alot!


  • Closed Accounts Posts: 4,655 ✭✭✭Ph3n0m


    you may thank me - but did it work?


Advertisement