CodeIgniter Forums
Image Library Resize problem - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Image Library Resize problem (/thread-13079.html)

Image Library Resize problem - El Forum - 11-10-2008

Hi there,

I'm having a problem with the image library functionality. I noticed it had stopped working (during development) and can't figure out why, as nothing has changed in my application or my development setup to cause it.

Here is the code:
// Create a thumbnail
        $config['image_library']    = 'gd2';
        $config['source_image']    = $new_file_name_orig;
        $config['new_image']        = $new_file_name_thmb;
        $config['maintain_ratio']    = TRUE;
        $config['width']            = 120;
        $config['height']            = 120;
        $config['quality']            = 100;

        $this->load->library('image_lib', $config);
        echo '<br />';

The $new_file_name_orig var is just the path to the image, which is correct. The $new_file_name_thmb is the path to the thumbnail I want created. The original file is CHMOD'd to 777 and the folder that contains it, as well as the folder I'm writing the thumbnail to are 777.

The results of my debugging seem to suggest the image is being resized:

string(0) ""

but it's not. No image is created in the thumbnail directory and no image is resized. I thought it might have been something simple like the path being wrong but since the debug output returns TRUE, I'm guessing the problem is elsewhere?

Any ideas kind people?!

Image Library Resize problem - El Forum - 11-10-2008

Sorry please ignore, seems to be working again using this code that I borrowed from another app I'd made:

$config['image_library'] = 'GD2';
        $config['maintain_ratio'] = TRUE;
        $config['source_image']    = $new_file_name_orig;
        $config['new_image']    = $new_file_name_thmb;
        $config['quality'] = 100;
        $config['width'] = 120;
        $config['height'] = 120;
        $config['create_thumb'] = FALSE;
        $config['master_dim']   = 'auto';
        $config['dynamic_output'] = FALSE;
        echo $this->image_lib->resize();

I can't tell what the difference is exactly but at least it works!