[eluser]adi sembiring[/eluser]
Hi ..., I'm trying implementing crop image with coordinate. but the it doesn't success if for the coordinate. my code is :
Code:
function image_thumb($image_path, $height, $width, $x=0, $y=0)
{
// Get the CodeIgniter super object
$CI =& get_instance();
// Path to image thumbnail
$image_thumb = dirname($image_path) . '/' . $height . '_' . $width . '.jpg';
if( ! file_exists($image_thumb))
{
// LOAD LIBRARY
$CI->load->library('image_lib');
// CONFIGURE IMAGE LIBRARY
$config['x_axis'] = $x;
$config['y_axis'] = $y;
$config['image_library'] = 'gd2';
$config['source_image'] = $image_path;
$config['new_image'] = $image_thumb;
$config['maintain_ratio'] = TRUE;
$config['height'] = $height;
$config['width'] = $width;
$CI->image_lib->initialize($config);
$CI->image_lib->resize();
$CI->image_lib->clear();
}
return '<img src="' . dirname($_SERVER['SCRIPT_NAME']) . '/' . $image_thumb . '" />';
}