Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

thumbnail dimension question

Options
  • 01-11-2006 9:39am
    #1
    Registered Users 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 Posts: 648 ✭✭✭ChicoMendez


    Tnx alot!


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


    you may thank me - but did it work?


Advertisement