Welcome Guest, Not a member yet? Register   Sign In
CI creates thumb but won't resize - non-logical error
#1

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

[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..
#3

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

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

Fabian




Theme © iAndrew 2016 - Forum software by © MyBB