Crop photo

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
westen
Forum Newbie
Posts: 14
Joined: Mon Oct 29, 2007 9:03 am

Crop photo

Post by westen »

I have a photo that is 200*400. I wish to make it 200*200 by chopping off the bottom of the photo. At present I am attempting to use:

imagecopyresized($canvas, $piece, 0, 0, 0, 0 , $w, $h, $width, $height);

I assumed that I would just put the heights different and this would work but this just squashes it.

I can change where the x and y coords are but this just gives me black stuff around the picture.

Am I using the right function? If anyone can please help me i would very much appreciate it.

Cheers,
Westen
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Crop photo

Post by Jade »

Are you trying this on a .jpg or a .gif? I found you get the black only on transparent .gifs. You could try changing it to a jpeg.
westen
Forum Newbie
Posts: 14
Joined: Mon Oct 29, 2007 9:03 am

Re: Crop photo

Post by westen »

I am using jpegs.

Regards,
Westen
Post Reply