Welcome Guest, Not a member yet? Register   Sign In
Possible Image Lib bug?
#1

[eluser]jstrebel[/eluser]
Is this a bug or am I just not getting it: I upload an image, resize it to $x1,$y1 then thumbnail it to $x2,$y2. So i should have 2 images.. one called image.jpg and another called image_thumb.jpg.

Code:
//$path= path to file, $x,$y are size demisions
function _image_resize ($path,$x1,$y1,$x2,$y2)
        {

                        $this->image_lib->clear();
                        //resize Image
                        $config['image_library'] = 'GD2';
                        $config['source_image'] = $path;
                        $config['width'] = $x1;
                        $config['height'] = $y1;
                        $config['master_dim'] = 'auto';
                        $config['quality'] = '100%';

                        $this->image_lib->initialize($config);
                        $this->image_lib->resize();
                        
                        $this->image_lib->clear();
                        //thumbnail the image just resized
                        $config2['image_library'] = 'GD2';
                        $config2['source_image'] = $path;
                        $config2['width'] = $x2;
                        $config2['height'] = $y2;
                        $config2['master_dim'] = 'auto';
                        $config2['quality'] = '100%';
                        $config2['create_thumb'] = TRUE;

                        $this->image_lib->initialize($config2);
                        $this->image_lib->resize();
        }

What I am actually getting from this function is 1 image called image.jpg (no _thumb) sized to $x2,$y2 (the thumbnail specs). Any thoughts?
#2

[eluser]jstrebel[/eluser]
Solution:
added

unset($this->image_lib);
$this->image_lib = new CI_Image_lib();

between iterations.. works.




Theme © iAndrew 2016 - Forum software by © MyBB