Welcome Guest, Not a member yet? Register   Sign In
Memory Exhausted when trying to resize
#2

[eluser]metamorpher[/eluser]
Well I figured out what the problem was.

I just had to call the clear function after the get_image_properties function.

That's it.. so if you have the same problem, you can know how to solve it:

Here's the final sketch of the generate_thumbnail function:

Code:
function generate_thumbnail($img_path_file, $size)
    {
        
        $this->load->library('image_lib');

        $img_data = $this->image_lib->get_image_properties($img_path_file, TRUE);

        // HERE'S THE BAD BOY WE WERE LOOKIN' FOR
        $this->image_lib->clear();

        if($img_data['width'] > $img_data['height'])
        {
            $conf['height'] = $size;            
        }
        else if($img_data['width'] < $img_data['height'])
        {
            $conf['width'] = $size;
        }

        $conf['source_image']    = $img_path_file;
        $conf['maintain_ratio'] = TRUE;
        $conf['image_library']    = 'gd2';

        if(!$this->image_lib->resize())
        {
            return false;
        }

        $this->image_lib->clear();

        return true;
    }


Messages In This Thread
Memory Exhausted when trying to resize - by El Forum - 03-28-2011, 02:56 PM
Memory Exhausted when trying to resize - by El Forum - 03-28-2011, 05:29 PM
Memory Exhausted when trying to resize - by El Forum - 03-28-2011, 08:06 PM
Memory Exhausted when trying to resize - by El Forum - 03-28-2011, 08:13 PM
Memory Exhausted when trying to resize - by El Forum - 07-29-2011, 03:20 PM
Memory Exhausted when trying to resize - by El Forum - 08-01-2011, 12:07 AM



Theme © iAndrew 2016 - Forum software by © MyBB