Welcome Guest, Not a member yet? Register   Sign In
Crop With Coordinate
#1

[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 . '" />';
}
#2

[eluser]adi sembiring[/eluser]
ups ...,

I used the wrong function.

Code:
$CI->image_lib->crop();
If I used this function I can set the x1 and x2 of the coordinate




Theme © iAndrew 2016 - Forum software by © MyBB