php - Resize uploaded image to max width, max height? -


I have a php image upload upload form and what I want to do before the image is saved on my server , It needs to be resized in order to ensure that the height does not exceed the maximum height set, and the width does not exceed the maximum width. I was thinking of doing this before it would be first) check whether the width is greater than the maximum width or not. If so, resize the image so that the width is equal to the maximum width. Then, check the height if the height exceeds the maximum height, then change the proportional size of the image so that the height is equal to the maximum height.

Any suggestions? GD is installed on my server ..

Assume that the image echo $ _FILES ["file"] ["name"]; Use of

gd is light as it is It is an idea that you want to resize images without using a library, basically just humorous.

Comments