Welcome Guest, Not a member yet? Register   Sign In
Resizing the same image twice. SOLVED.
#1

[eluser]HovaCarlito[/eluser]
Heya,

I'm probably overlooking something or missing something. I'm making a simple CMS where an uploaded file gets resized twice - once to make sure the file isn't huge and another time to make the thumbnail.

The code:


Code:
function handleResize($path){
        $config['image_library'] = 'gd2';
        $config['source_image'] = $path;
        $config['maintain_ratio'] = TRUE;
        $config['width']     = 375;
        $config['height']    = 500;
        $config['create_thumb'] = TRUE;
    
        $this->image_lib->initialize($config);
        
        if ( ! $this->image_lib->resize()){
            echo $this->image_lib->display_errors();
        }
        else{
            echo "done1";    
        }
        
        $this->image_lib->clear();
        
        $config_big['image_library'] = 'gd2';
        $config_big['source_image'] = $path;
        $config_big['maintain_ratio'] = TRUE;
        $config_big['width']     = 510;
        $config_big['height']    = 680;
        
        
    
        $this->image_lib->initialize($config_big);
        
        if ( ! $this->image_lib->resize()){
            echo $this->image_lib->display_errors();
        }
        else{
            echo "done2";
        }

    }

Now the result: any file I upload gets processed both times (it echo's both the resultmessages) but somehow it seems to use the width/height of the second config set (the $config_big) in the thumbnail and no resizing on the second pass. Am I missing something?

Thanks in advance!


Messages In This Thread
Resizing the same image twice. SOLVED. - by El Forum - 08-26-2010, 03:14 PM
Resizing the same image twice. SOLVED. - by El Forum - 08-26-2010, 03:27 PM
Resizing the same image twice. SOLVED. - by El Forum - 08-27-2010, 09:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB