CodeIgniter Forums
CI creates thumb but won't resize - non-logical error - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: CI creates thumb but won't resize - non-logical error (/thread-22509.html)



CI creates thumb but won't resize - non-logical error - El Forum - 09-11-2009

[eluser]Fabdrol[/eluser]
Dear fellow developers,

I'm busy with a new (google gears based) photo uploader, and need to do some picture manipulation.

A function does (or has to do) two things, first it creates a thumbnail of 150px by 150px, then it has to take the same source image and create a second "thumb" of 500x800 (max)

Some how, It works when creating the thumb. But then, it stalls and gives te following error:

Code:
Thumb created
Resize error: <p>Your server does not support the GD function required to process this type of image.</p>
success!

The success! part is a log message to tell me that the upload went correctly.

below is my code!

thanks!

Code:
$this->load->library('image_lib');

$config['image_library'] = 'gd2';
$config['source_image'] = $file;
$config['create_thumb'] = true;
$config['maintain_ratio'] = true;
        
// settings for first (small) thumbnail
$config['thumb_marker'] = '_thumb';
$config['width'] = 150;
$config['height'] = 150;
        
$this->image_lib->initialize($config);
        
if(!$this->image_lib->resize()) {
    echo "Thumb error: ".$this->image_lib->display_errors()."\n";
} else {
    echo "Thumb created\n";
}
        
$this->image_lib->clear();
        
$config['thumb_marker'] = '_web';
$config['width'] = 500;
$config['height'] = 800;
        
if(!$this->image_lib->resize()) {
    echo "Resize error: ".$this->image_lib->display_errors()."\n";
} else {
    echo "Resized.\n";
}
        
$this->image_lib->clear();



CI creates thumb but won't resize - non-logical error - El Forum - 09-11-2009

[eluser]Fabdrol[/eluser]
The strange thing is that the image for resizing is the same, as is the logic, so since the thumb was indeed created GD shouldn't have any problems processing the resize..


CI creates thumb but won't resize - non-logical error - El Forum - 09-11-2009

[eluser]Aken[/eluser]
You didn't initialize the image_lib again with your new $config items.


CI creates thumb but won't resize - non-logical error - El Forum - 09-13-2009

[eluser]Fabdrol[/eluser]
How stupid of me! Thanks, I'll post again if it works (or didn't)

Fabian