CodeIgniter Forums
Resizing image problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Resizing image problem (/showthread.php?tid=2787)



Resizing image problem - El Forum - 08-24-2007

[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();


Resizing image problem - El Forum - 08-24-2007

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

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