Link to home
Start Free TrialLog in
Avatar of maccaj51
maccaj51Flag for Afghanistan

asked on

PHP Jquery Image upload and crop

Hi Experts,

I am farily new to PHP and jquery so as much detailed help as possible would be greatly appreciated

I need to do the following:

1. Upload an image
2. Crop it to become equal width and length (i.e. Square)
3. Resize it to say 300 x 300 pixels
4. Rename it and save it to a folder

Please someone patch a script together to help!!!

MANY THANKS IN ADVANCE
Avatar of haloexpertsexchange
haloexpertsexchange
Flag of United States of America image

what kind of images to you need to work with?
Avatar of maccaj51

ASKER

jpg, gif or png would be great!
you can use the gd library in php to do this.
look in your php_info and see if you have it installed already, most newer version of php do, and it should also tell you what version of it you have.

http://php.net/manual/en/book.image.php
This the manual for it.
Give me a few minutes and I will get something together.
imagemagick is nice but it can be a pain to install and use.
I do indeed have it installed... Halo your a legend!
I can arbitrarily crop the image, any size that you want it cropped to, say if the height is larger crop to width or the other way around?
It would be nice for the user to crop it... i.e. Jcrop or something like that...

I am making a basic CMS... the images on the site need to be square but i dont trust the users photoshop skills - hence being able to crop online...

Does this make sense?
Basically so they can choose the focus of the image aswell...
so would the locations be passed in with the image so that you don't have to worry about calculating an sort of best location and size.
If that is so this gets easier to do.
I will assume that the locations that are being cropped will be passed in.
ASKER CERTIFIED SOLUTION
Avatar of haloexpertsexchange
haloexpertsexchange
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for your help!