Resizing and croping with GD

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Souljacker
Forum Newbie
Posts: 1
Joined: Thu Mar 13, 2008 11:19 pm

Resizing and croping with GD

Post by Souljacker »

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 =/
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: Resizing and croping with GD

Post by alex.barylski »

imagecopy to crop, then imagecopyresized to resize cropped image...
Post Reply