Welcome Guest, Not a member yet? Register   Sign In
image library crop issue -SOLVED
#1

[eluser]kbauman[/eluser]
I've looked through lots of the forum posts, and have not been able to figure out where my problem is.

I have an image upload that resizes a large image, then crops a section out of the image. I've gotten the resize to work, and even the crop to work. The problem is that no matter what I put in the x or y axis specifications, it always crops from the upper left.

Code:
$img_width = $up_data['image_width']; //resized large image width
$img_height = $up_data['image_height']; //resized large image height
//Crop to:
$config3['width'] = 150;
$config3['height'] = 150;
$config3['x_axis'] = (($img_width - 150)/2); //crop from center
$config3['y_axis'] = (($img_height - 150)/2); //crop from center
$config3['new_image'] = './images/thumbs/'.$up_data['file_name'];
$config3['quality'] = '100%';
$this->image_lib->initialize($config3);
$this->image_lib->crop();

From my understanding the x and y axis are supposed to indicate where the cropping will occur. I can put any number in for the x and y axis and still end up with a crop from the top left.

Any thoughts?
#2

[eluser]kbauman[/eluser]
I hate when this happens. After changing and moving comments in my code, it now works. Go figure. Obviously I changed something, but I'm not sure what it was.




Theme © iAndrew 2016 - Forum software by © MyBB