crop an image and save it

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
fabby
Forum Commoner
Posts: 62
Joined: Tue Feb 15, 2005 1:06 am
Location: Romania
Contact:

crop an image and save it

Post by fabby »

Hi.
I want, when someone want to upload a picture, to crop to resize to 800px x 600px and if is larger when i resizeit, to crop. Then, the result i want to upload on the server.
It is possible that?
Thanks.
User avatar
panic!
Forum Regular
Posts: 516
Joined: Mon Jul 31, 2006 7:59 am
Location: Brighton, UK

Re: crop an image and save it

Post by panic! »

Yes it is possible.

http://uk.php.net/gd
Stacks
Forum Newbie
Posts: 24
Joined: Thu Jun 05, 2008 7:52 pm

Re: crop an image and save it

Post by Stacks »

Also look into imagick.

You will need to install the imagick pecl module.

Instructions can be found at http://valokuva.org/

Once installed it's as easy as

Code: Select all

 
    $image = new Imagick($file_name);
    $image->cropThumbnailImage(800, 600);
    $image->writeImage($new_file_name);
 
Post Reply