Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] Problems with Thumbnail Creation Loops
#1

[eluser]phused[/eluser]
When a user uploads a file I require multiple thumbnails with different dimensions to be created, I'm trying to achieve this using the following code in a model:

Code:
function create_thumb($file)
    {
        // Image resizing config
        $config = array(
                    // Concept Page
                    array(
                        'image_library' => 'GD2',
                        'source_image'    => 'uploads/'.$file,
                        'create_thumb'    => TRUE,
                        'maintain_ratio'=> TRUE,
                        'width'            => 632,
                        'height'        => 451
                        ),
                    // Workspace Page
                    array(
                        'image_library' => 'GD2',
                        'source_image'    => 'uploads/'.$file,
                        'create_thumb'    => TRUE,
                        'maintain_ratio'=> FALSE,
                        'thumb_marker'    => '_ws_thumb',
                        'width'            => 184,
                        'height'        => 184
                    ),
                    // Dashboard Page
                    array(
                        'image_library' => 'GD2',
                        'source_image'    => 'uploads/'.$file,
                        'create_thumb'    => TRUE,
                        'maintain_ratio'=> FALSE,
                        'thumb_marker'    => '_db_thumb',
                        'width'            => 244,
                        'height'        => 244
                    ));
        
        foreach ($config as $item)
        {
            
            $this->load->library('image_lib', $item);
            
            if(!$this->image_lib->resize())
            {
                return false;
            }
            
            $this->image_lib->clear();
        }
    }

When I call this function, it only create the first thumbnail in the array (The first sub-array, it skips the second and third sub-array). Any idea why this is happening?


Messages In This Thread
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 05-29-2009, 09:03 AM
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 05-29-2009, 10:14 AM
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 05-29-2009, 10:21 AM
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 06-25-2009, 09:55 PM
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 09-25-2009, 11:17 AM
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 11-12-2009, 07:07 AM
[SOLVED] Problems with Thumbnail Creation Loops - by El Forum - 03-08-2010, 11:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB