aunquarra Posted January 20, 2007 Share Posted January 20, 2007 I'm working on a php-driven integrated image upload/control system that generates various image sizes, which in and of itself is pretty simple.What I'm working on now is making the thumbnail generation a user-interactive system. Specifically, they can pick a region of the image to be targeted for the thumbnail. On the php side, this, again, will be relatively simple. But the only option I've found for picking the target area is to image map every pixel so I know where a person clicked for the corners of the target area. So much for efficiency.So I figured javascript could have a much more efficient solution, and to my surprise, I found no help from the Oracle (what my wife and I call Google). Does anyone here know a way javascript can post an X and Y position of an image to a form onClick? Quote Link to comment Share on other sites More sharing options...
artacus Posted January 21, 2007 Share Posted January 21, 2007 Well you'd have to add an event listener to your image then store the mouse x,y on mouse down and the mouse x,y on mouse release. That would let you draw a rectangle and send back to php which parts of your image to crop. But it wouldn't give the user any visual feedback. I guess you could position a div that only had borders right over the box you just drew. Quote Link to comment Share on other sites More sharing options...
aunquarra Posted January 21, 2007 Author Share Posted January 21, 2007 My plan was to have JS or whatever client-side code is running post the x and y position to a form and submit. Then, I'd use PHP to superimpose an X or whatever over the spot, then they'd click the other corne, which would post in the same manner.It's not as intuitive as I'd like, but when you know no client-side stuff at all, you do as much with server side as you can. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.