Solved

PHP Jquery Image upload and crop

Posted on 2011-09-29
13
722 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
 
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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article discusses how to create an extensible mechanism for linked drop downs.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to count occurrences of each item in an array.
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 …

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now