CodeIgniter Forums

Full Version: Implementing Jcrop to CI? (jQuery Image cropper)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]RS71[/eluser]
Hello

I was wondering on how I might be able to implement Jcrop to CI using the Image Manipulation class.

From what I gather I'd need to alter the following script:

Code:
<?php

$targ_w = $targ_h = 150;
$jpeg_quality = 90;

$src = 'demo_files/flowers.jpg';
$img_r = imagecreatefromjpeg($src);
$dst_r = ImageCreateTrueColor( $targ_w, $targ_h );

imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
    $targ_w,$targ_h,$_POST['w'],$_POST['h']);

imagejpeg($dst_r, $output_filename, $jpeg_quality);
?>

I've noticed a couple of parameters I'd know how to use with the class but I'm a bit confused about the rest. I'm not too familiar with GD so I wouldn't know to apply the code. Could somebody possibly help me? (Also I noticed that supposedly above only works with jpegs, how would I make it work with gifs and pngs as well?)

Thanks in advance.