Welcome Guest, Not a member yet? Register   Sign In
Resizing image problem
#1

[eluser]K-C[/eluser]
I have been trying to resize an uploaded image to create thumbnail and never managed to create the thumbnail file in the folder, however I am able to upload the original file. PLease enlighten me on what's wrong in my code. My code is as follow.


$img = $this->upload->data();
$uploadDir = $basepath.'/imgs/test/';
// let's create a thumbnail while we're here.
$config['image_library'] = 'GD2';
$config['source_image'] = $img['file_name'];
$config['new_image'] = $basepath.'/imgs/thumb_'.$img['file_name'];
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 5;
$config['height'] = 5;

$this->load->library('image_lib');
$this->image_lib->initialize($config);
$this->image_lib->resize();
#2

[eluser]#1313[/eluser]
i'd suggest to output any errors

Code:
if ( ! $this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
}




Theme © iAndrew 2016 - Forum software by © MyBB