M
M
Mithgol2013-05-08 22:45:42
PHP
Mithgol, 2013-05-08 22:45:42

Is there an open source code for cutting out a fragment of an illustration with a single click of the mouse?

I really don’t want to reinvent the wheel, so here’s the question: is there a ready-made tool that combines the client side (in JavaScript) and the server side (for example, in PHP) to solve one of the simple image processing tasks - to cut a fragment (of a known size) from some illustrations performed with a single click of the mouse button?

The bottom line is this: there is an illustration, the user moves the mouse cursor over it, and at the same time, after the cursor (around the corner or in the middle), a certain frame of a given size is dragged. When the user clicks on the mouse button, the coordinates of the part to be cut are sent to the server, and there a fragment is cut out of the image along this frame and saved to its own file.

Cutting itself is an extremely simple matter (its PHP code is provided by John Conde in a comment dated May 27, 2009 to the help about the imagecopy function - there are a dozen lines, not counting the comments). I'm more concerned about intercepting the relative coordinates of the cursor when moving and clicking the mouse, after which I also have to prevent the clipping box from going beyond the image borders if the mouse cursor came too close to them. At least twenty minutes can easily be killed writing and debugging such JavaScript code, even relying on jQuery. Maybe there is a ready-made code in simple javascript or a plugin for jQuery?

If you know where it is - tell me the address, please.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Mithgol, 2013-05-08
@Mithgol

Found imgAreaSelect with much more flexible settings. I will take it as a solution.

M
Mithgol, 2013-05-08
@Mithgol

However, after four minutes, I nevertheless found a very impressive and free Simple-Image-Crop plugin on my own - this will probably be the solution, unless someone tells you a significantly more convenient solution.

C
CrazySquirrel, 2013-05-08
@CrazySquirrel

deepliquid.com/projects/Jcrop/demos.php?demo=live_crop
It?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question