Solved

PHP Jquery Image upload and crop

Posted on 2011-09-29
13
748 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:maccaj51
  • 6
  • 6
13 Comments
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 36815627
what kind of images to you need to work with?
0
 

Author Comment

by:maccaj51
ID: 36815652
jpg, gif or png would be great!
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36815685
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 36815689
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.
0
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 36815700
imagemagick is nice but it can be a pain to install and use.
0
 

Author Comment

by:maccaj51
ID: 36815706
I do indeed have it installed... Halo your a legend!
0
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 36815867
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?
0
 

Author Comment

by:maccaj51
ID: 36815880
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?
0
 

Author Comment

by:maccaj51
ID: 36815882
Basically so they can choose the focus of the image aswell...
0
 
LVL 13

Expert Comment

by:haloexpertsexchange
ID: 36815901
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.
0
 

Author Comment

by:maccaj51
ID: 36815915
0
 
LVL 13

Accepted Solution

by:
haloexpertsexchange earned 500 total points
ID: 36815940
looks cool, much faster than having to write stuff up by hand and should have most of the bugs fixed already.
0
 

Author Closing Comment

by:maccaj51
ID: 36930061
Thanks for your help!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question