[eluser]SPeed_FANat1c[/eluser]
Hi,
I made a function
Code:
function image_resize($image_name)
{
$this->load->library('image_lib');
$config['image_library'] = 'gd2';
$config['source_image'] = './uploads/info_pages/'.$image_name;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->load->library('image_lib', $config);
//$this->image_lib->initialize($config);
if ( ! $this->image_lib->resize())
{
return $this->image_lib->display_errors();
}
else return 'ok';
}
And you see there is one line commenter - $this->image_lib->initialize($config);
When this line is commended, resizing does not work.
But if we look at the documentation, example is such:
Code:
$config['image_library'] = 'gd2';
$config['source_image'] = '/path/to/image/mypic.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$this->load->library('image_lib', $config);
$this->image_lib->resize();
So there is no initialization line. This is a mistake I guess. I am lucky that I had old examples and quickly found, but for those who are new to CI it is hard to find why it does not work.