Welcome Guest, Not a member yet? Register   Sign In
About image croping
#1

[eluser]Rubiz'[/eluser]
Hi all, I'm using this code and my image is not croped...
Anyone knows what I'm doing wrong?
Code:
$info = getimagesize($path . 'tb_' . $file);
                    
        if ( $info[0] / $info[1] != 0 ) //if the source image is NOT a square
        {
            $config['source_image']      = $path . 'tb_' . $file;
            
            if ( $info[0] > $info[1] ) //the image is horizontal
            {
                $x = $info[0] - $info[1];
                $config['x_axis'] = $info[0] - $x;
                $config['y_axis'] = $info[1];
            }
            else //the image is vertical
            {
                $x = $info[1] - $info[0];
                $config['x_axis'] = $info[0];
                $config['y_axis'] = $info[1] - $x;
            }

            //cropping
            $this->image_lib->initialize($config);
            $this->image_lib->crop();
        }
#2

[eluser]Rubiz'[/eluser]
I got it, but if u want to crop from top left to bottom right of the image, the x and y axis are 0 (zero).
You have to set ratio FALSE, and config width/height too.

Thanx




Theme © iAndrew 2016 - Forum software by © MyBB