unplugged_web Posted November 29, 2012 Share Posted November 29, 2012 This might not be the place to ask this, but from my understand of the GD library I can do this with PHP. What I want to do is have an image on a page that somebody can select a square area of (any size) and after click to say it's okay that area is saved to the server. If the selected area isn't right then they can move it around or select a different area altogether. I've no idea how to do this and wondered if anybody could help please. I've attached a couple of screen grabs to hopefully show better what I mean. Link to comment Share on other sites More sharing options...
birbal Posted November 29, 2012 Share Posted November 29, 2012 It will nedd involvement of JS. There is many ways to do that. one would be, when user try to draw a square, they click on a place and keep on dragging the mouse. so you can catch click cordinates and mouseup cordinates. once you know the both co-ordinates you can calculate the length of between them and even the other two cordinate of rest of to points of square/rectangle (use cordinate geometry formulas). once you have four cordinates you can decide the real cordinates respective to the original image. So now you have original image dimension, crop box dimension. you can use those data to crop the image imagecopyresampled() and save it. Link to comment Share on other sites More sharing options...
unplugged_web Posted November 29, 2012 Author Share Posted November 29, 2012 That sounds like what I'm after, do you know of any examples/tutorials? I don't really know how to do that myself without any help.Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted November 29, 2012 Share Posted November 29, 2012 Don E made this site: http://www.cropthis.net Apparently he figured out how to do that. I'm sure it took him quite a bit of work to get there, though. Link to comment Share on other sites More sharing options...
unplugged_web Posted November 30, 2012 Author Share Posted November 30, 2012 Don E made this site: http://www.cropthis.net Apparently he figured out how to do that. I'm sure it took him quite a bit of work to get there, though.Thanks that's exactly what I want to do, except I want it to be saved to the server rather than the desktop. Link to comment Share on other sites More sharing options...
thescientist Posted December 3, 2012 Share Posted December 3, 2012 (edited) I'm sure it's just a small tweak in the code if you manage to make it that far. Edited December 3, 2012 by thescientist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now