Reputation: 5298
i have a php image upload upload form and what i want to do is before the image is saved on my server, it needs to be resized to make sure the height doesnt exceed the max height ive set, and the width doesnt exceed the max width i set. I was thinking the way to do it would first be a) check if the width is greater than max width. If so, PROPORTIONALLY resize image so the width equals the max width. Then, check the height. If the height exceeds max height, proportionally resize the image so the height equals the max height.
Any suggestions? GD is installed on my server..
Assume that the image is echo $_FILES["file"]["name"];
Upvotes: 0
Views: 4389
Reputation: 10939
I've answered a similar question to what you are asking:
It uses GD b/c like chaos says, it doesn't get any more lightweight.
This script resizes an image on demand, but caches each size of each image that has ever been called so that it doesn't have to be resized again.
Upvotes: 0
Reputation: 124365
Using gd
is as lightweight as it's going to get. The idea that you're going to resize images without using a library is basically just humorous.
Upvotes: 2