CodeIgniter Forums
Image Library Resize 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: Image Library Resize problem (/showthread.php?tid=13079)



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

[eluser]bapobap[/eluser]
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:
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);
        var_dump($this->image_lib->resize());
        echo '<br />';
        var_dump($this->image_lib->display_errors());

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:

Code:
bool(true)
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

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

Code:
$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;
        
        $this->image_lib->initialize($config);
        echo $this->image_lib->resize();

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