Welcome Guest, Not a member yet? Register   Sign In
Image resize, weird bug?
#1

[eluser]Chris Newton[/eluser]
So... why does this work:
Code:
function get_image($image_name,$time=NULL)
    {      
        $upload_info=$this->load->config('upload');
        $config['source_image']        =    $this->config->item('edit_path').$image_name;
        $config['quality']               =     100;
        list($config['width'],$config['height']) =    getimagesize($config['source_image']);  
        $config['width']-=1;
        $config['maintain_ratio']    =    FALSE;
        $config['dynamic_output']    =    TRUE;    
        $this->load->library('image_lib', $config);
        if ( ! $this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();  
            var_dump($config);
        }
        else
        {
            echo $this->image_lib->resize();
        }
    }

when this doesn't:
Code:
function get_image($image_name,$time=NULL)
    {      
        $upload_info=$this->load->config('upload');
        $config['source_image']        =    $this->config->item('edit_path').$image_name;
        $config['quality']               =     100;
        list($config['width'],$config['height']) =    getimagesize($config['source_image']);  
        $config['maintain_ratio']    =    FALSE;
        $config['dynamic_output']    =    TRUE;    
        $this->load->library('image_lib', $config);
        if ( ! $this->image_lib->resize())
        {
            echo $this->image_lib->display_errors();  
            var_dump($config);
        }
        else
        {
            echo $this->image_lib->resize();
        }
    }

The only difference in #2 (where image resize is not working) is that I didn't subtract 1 from the image's width. I've tried round() and floor() just to be sure there's not some tiny fraction slipping in there somehow, I've tried adding / subtracting 0, adding 1 after I've subtracted it, and using settype(). The only thing that seems to make this dynamic_output instance of the resize is by making the width slightly different from the actual width.

Anyone have any idea why this is happening? I'm gonna go delve into the image_manipulation library to see if I can figure it out, but so far nothing's popping up.


Messages In This Thread
Image resize, weird bug? - by El Forum - 04-18-2008, 12:52 AM
Image resize, weird bug? - by El Forum - 04-18-2008, 03:22 AM
Image resize, weird bug? - by El Forum - 04-18-2008, 06:10 PM
Image resize, weird bug? - by El Forum - 04-18-2008, 06:40 PM
Image resize, weird bug? - by El Forum - 04-20-2008, 10:16 PM



Theme © iAndrew 2016 - Forum software by © MyBB