[eluser]Alhazred[/eluser]
I have a form with a file field to upload an image, this image must be resized to fit a space on a page.
The upload works correctly, but the resize does't.
Here is how I do the resize
Code:
$config['image_library'] = 'gd2';
$config['source_image'] = '.'.$this->config->item('upload_image_base').'/'.'logo_'.$id.'.jpg';
$config['height'] = 70;
$config['width'] = 300;
$config['maintain_ratio'] = TRUE;
$config['master_dim'] = 'height';
$this->load->library('image_lib', $config);
$this->image_lib->resize();
The source image is
This is how CodeIgniter resizes it
As you can see it is not correctly resized, the resized image has a black border, what is the problem? How to solve it?