I have a file upload form where I upload only jpg, png and gif images. I resize the image if its width is more then 225 and height automatically fix with that width.
if($width > 225) {
$newwidth = 225;
}
else {
$newwidth = $width;
}
$newheight = ($height/$width)*$newwidth;
The above code fixes the width for me in case if image > 225. Now the problem is that the new height is according to the image width. I don't want the height to be more then 150. How can I fix it with out stretching the image?