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.

#2
[eluser]Lone[/eluser]
Are you sure that $config['width'] is set after the list command?

#3
[eluser]Chris Newton[/eluser]
Regardless of where it's set, if width isn't shrunk by 1 it does not work.

#4
[eluser]missionsix[/eluser]
why are you trying to resize an image to its current dimensions?

edit: you might want to use image_lib->display_errors(); to get the list of errors that are occuring

#5
[eluser]Chris Newton[/eluser]
Resize is also used to copy. In this case I'm copying it to dynamic output on screen as part of a larger operation.

display_errors didn't give me much clue at the time. I'll turn them back on and copy out the response when I get a few.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.