[eluser]Stephane02[/eluser]
Hi,
I have issues using the Image Lib library. As I've been successfully used it for the other functions (resize, watermarking,...) the cropping function does not work at all and it does not return any error. The crop() function actually returns TRUE as if everything went through but the target image does not change and the last successes I had with the code below gave a black and not cropped image. Maybe you can help especially if any of you ever make it work. I would be happy if you can show me your working "cropping" codes. I've been googled on the subject and it seems many people have the same issue with this Codeigniter class.
Here's the code I'm using right now, what could be wrong?
Code:
$shot_config['create_thumb'] = FALSE;
$shot_config['source_image'] = './images/shots/'.$data['shot_info']['username'].'/'.$data['shot_info']['shot'];
$shot_config['new_image'] = './images/shots/'.$data['shot_info']['username'].'/cropped_'.$data['shot_info']['shot'];
$shot_config['width'] = $this->input->post('crop_width');
$shot_config['height'] = $this->input->post('crop_height');
$shot_config['x_axis'] = $this->input->post('crop_x_offset');
$shot_config['y_axis'] = $this->input->post('crop_y_offset');
$this->load->library('image_lib', $shot_config);
$this->image_lib->initialize($shot_config);
if($this->image_lib->crop())
{
echo 'crop ok';
}
else
{
echo $this->image_lib->display_errors();
}
Thank you for helping,
Stephane