Resizing and croping with GD
Posted: Thu Mar 13, 2008 11:24 pm
Greetings
I'm coding a MOTIVATIONAL POSTER generator. It's all working ok, but this part.
I want the user to be able to upload any imagem and make it fit the 600x400 screen.
For exemple: if he uploads a image of 1000x500, the script would resize it to 800x400 (the smaller side) and crop 200px from the 800.
Same if the image is smaller then 600x400.
Let's say an 400x300 image. It would resize it to 600x450 then crop 50px from the 450.
The question is how to do it. I can't figure how =/
I'm coding a MOTIVATIONAL POSTER generator. It's all working ok, but this part.
I want the user to be able to upload any imagem and make it fit the 600x400 screen.
For exemple: if he uploads a image of 1000x500, the script would resize it to 800x400 (the smaller side) and crop 200px from the 800.
Same if the image is smaller then 600x400.
Let's say an 400x300 image. It would resize it to 600x450 then crop 50px from the 450.
The question is how to do it. I can't figure how =/