This is a mootools plugin to select a part of an image to crop it (or whatever). It provides a draggable and resizable layer above an image (showing the current dimensions, optionally) and a "crop"-button, which delivers the coordinates of the selection.
http://www.chipwreck.de/blog/software/cwcrop/cwcrop-demo/
If you use the default settings, the HTML-code found in /Demo/ can simply be used (except filename and sizes of course):
The method ch.doCrop() triggers the onCrop event, which writes the dimensions to the form fields and submits it.
ch = new CwCrop({ onCrop: function(values) { document.forms["crop"].elements["crop[x]"].value = values.x; document.forms["crop"].elements["crop[y]"].value = values.y; document.forms["crop"].elements["crop[w]"].value = values.w; document.forms["crop"].elements["crop[h]"].value = values.h; document.forms["crop"].submit(); }, maxratio: {x: 2, y: 1}, fixedratio: false });
See http://www.chipwreck.de/blog/software/cwcrop/help/ for more information.
A note on comments here: These comments are moderated. No comments will show up until they are approved. Comments that are not productive (i.e. inflammatory, rude, etc) will not be approved.
Found a bug in this plugin? Please report it this repository's Github Issues.
blog comments powered by Disqus