Welcome Guest, Not a member yet? Register   Sign In
Thumbs creation with Image Library - Problem
#13

[eluser]Soares[/eluser]
Following Xeoncross directions, it ended up working. I'm not sure why, but it did.

This is my original code (the one I start this post with):

Code:
function criarThumbs($info)
    {
        $this->load->library('image_lib');
        $config['image_library']     = 'gd2';
        $config['source_image']     = $info['full_path'];
        $config['create_thumb']     = TRUE;
        $config['maintain_ratio']     = TRUE;

        // mini_thumb
        $config['new_image']     = $info['file_path'] . '_mini_thumbs/'; // sem dizer o nome do arquivo. É automático.
        $config['width']         = 150;
        $config['height']         = 120;
        $config['quality']         = 100;

        $this->image_lib->initialize($config);
        log_message('debug', '[painel_acoes] Classe inicializada');
        echo "\nCriando mini_thumb: ";
        if ( ! $this->image_lib->resize())
        {
            echo "Erro:".$this->image_lib->display_errors();
        }
        else
        {
            echo "OK";
        }

        $this->image_lib->clear();

        // big_thumb
        $config['new_image']     = $info['file_path'] . '_big_thumbs/';
        
        $width = 600;
        $height = 500;
        $config['width']        = $width;
        $config['height']         = $height;
        $config['quality']         = 100;
        
        $this->image_lib->initialize($config); // novas configurações do big_thumb.
        echo "\nCriando big_thumb: ";
        if ( ! $this->image_lib->resize())
        {
            echo "Erro:".$this->image_lib->display_errors();
        }
        else
        {
            echo "OK";
        }
    }

After making some updates:

Code:
function criarThumbs($info)
    {
        $this->load->library('image_lib');
        $config['image_library']     = 'gd2';
        $config['source_image']     = $info['full_path'];
        $config['create_thumb']     = TRUE;
        $config['maintain_ratio']     = TRUE;

        // mini_thumb
        $config['new_image']     = $info['file_path'] . '_mini_thumbs/'; // sem dizer o nome do arquivo. É automático.
        $config['width']         = 150;
        $config['height']         = 120;
        $config['quality']         = 100;

        $this->image_lib->initialize($config);
        log_message('debug', '[painel_acoes] Classe inicializada');
        log_message('debug', '[painel_acoes] Criando mini_thumb');
        if ( ! $this->image_lib->resize())
        {
            log_message('error', $this->image_lib->display_errors());
        }
        else
        {
            echo "OK";
            log_message('debug', '[painel_acoes] mini_thumb: OK ');
        }

        $this->image_lib->clear();
        

        // big_thumb
        $config['new_image']     = $info['file_path'] . '_big_thumbs/';
        
        $width = 600;
        $height = 500;
        $config['width']        = $width;
        $config['height']         = $height;
        $config['quality']         = 100;
        
        $this->image_lib->initialize($config); // novas configurações do big_thumb.
        log_message('debug', '[painel_acoes] Classe 2 inicializada');
        log_message('debug', '[painel_acoes] Criando big_thumb');
        if ( ! $this->image_lib->resize())
        {
            log_message('error', $this->image_lib->display_errors());
        }
        else
        {
            echo "OK";
            log_message('debug', '[painel_acoes] big_thumb: OK ');
        }
    }

Basically, what I did was substituting some echos with a log function. The error part, for example, I changed echo for log_message.

Now, why would it influence the behavior of the script? I really don't know. After all, the first one, with all those echos, was perfectly working in my localhost.

Well.. Once done the above updates, I came back to those settings in the php.ini file.
Tried with:

Code:
max_execution_time = 15
memory_limit = 10M
and
Code:
max_execution_time = 200
memory_limit = 10M

None of this worked out. Than I tried this:

Code:
max_execution_time = 15
memory_limit = 100M
And it worked.

Making some tests, I figured that memory_limit should be as high as the images dimensions you are intending to upload.
Since I'm planning to let people upload pictures of until 3000x2500, I set memory_limit to 50MB. I'm not sure if that's the correct value for this dimensions, but it worked in my tests here.
I'm not sure either if these conclusions are correct, but at least it seems.

Jedd and Xeoncross, thanks a lot for your help!


Messages In This Thread
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 10:34 AM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 11:34 AM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 12:30 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 01:00 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 01:19 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 01:28 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 02:02 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 02:04 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 02:35 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 02:42 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 03:13 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 03:17 PM
Thumbs creation with Image Library - Problem - by El Forum - 09-07-2009, 05:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB