Sep 26 2008


MooCrop update

I have been amazed by the response I have received since releasing MooCrop. I’m slightly embarrassed that the project has suffered from decay over recent months. I have been insanely busy working at a startup and the thought of looking at more code at home made me nauseous. Over the past few months I have been able to get a handle on the various projects and look forward to being more active in the community.

With all that said I would like to thank Rok for putting in the extra effort to update MooCrop to run with Mootools 1.2. In addition Rok added ratio constraints, a feature that should make many happy.

All the documentation at and examples still apply.

An example of using the new constrainRatio option.

new MooCrop('crop_example', {
       'constrainRatio' : true

Click to Download MooCrop for Mootools 1.2

I have had several requests for the php code that I used in the final example to perform the crop. Below is the listing of the code. Its a quick an dirty hack but should provide a place to start.

$w = $_REQUEST['w'];
$h = $_REQUEST['h'];
$x = $_REQUEST['x'];
$y = $_REQUEST['y'];
header ("Content-type: image/jpg");
$src = @imagecreatefromjpeg("images/moo.jpg");
$im = @imagecreatetruecolor($w, $h);

More enhancements will be added to MooCrop in the near future.

Tags: , ,