Image Resize to fit custom width and height.
Posted on 2008-06-16
Can anyone recommend some code for resizing uploaded images to fit a custom width and height whilst keeping the correct ratio.
I have the image upload working fine but need code which takes the existing with and height and then resizes the image to fit a 186x123 thumb ( i can make it a square if need be)
I need the image aligned to the top.
I then need to pad out the image with whitespace on the left and right if the width is below 186.
I need to do the same with the height but if possible crop the whitespace from the bottom, if it goes below the defined height??
Has anyone got any suggestions!