CodeIgniter Forums
Implementing Jcrop to CI? (jQuery Image cropper) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Implementing Jcrop to CI? (jQuery Image cropper) (/showthread.php?tid=15339)



Implementing Jcrop to CI? (jQuery Image cropper) - El Forum - 02-01-2009

[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.