CodeIgniter Forums
Image resizing probelm - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Image resizing probelm (/showthread.php?tid=19454)



Image resizing probelm - El Forum - 06-08-2009

[eluser]MianUsman[/eluser]
Hi all,

i m uploading image with codeigniter code its working perfect but when i try to resize image it just fails i have enable GD2 in php setting but problem is still there.

please help me out

thanks in advance

Regards,
Usman Abdul-Razzaq


Image resizing probelm - El Forum - 06-08-2009

[eluser]umefarooq[/eluser]
can you upload you code how you are using resizing or check this url

http://makdotgnu.wordpress.com/2009/03/05/multiple-image-resizecrop-codeigniter/


Image resizing probelm - El Forum - 06-08-2009

[eluser]MianUsman[/eluser]
Code:
function resizeImage($source_image_path,$source_image_name,$new_image_name,$width,$height)
      {    
            
            $config['image_library'] = 'GD2';
            $config['source_image'] = $source_image_path.$source_image_name;
            $config['create_thumb'] = false;
            $config['maintain_ratio'] = TRUE;
            $config['quality'] = '100%';
            $config['new_image'] = $source_image_path.'thumbs/'.$new_image_name.'_'.$source_image_name;    
            $config['width'] = $width;
            $config['height'] = $height;
            $this->load->library('image_lib', $config);
            $this->image_lib->initialize($config);
            if ( ! $this->image_lib->resize())
            {
              echo $this->image_lib->display_errors();
            }

      }


here is my code. thanks for help


Image resizing probelm - El Forum - 06-08-2009

[eluser]umefarooq[/eluser]
here
$config['image_library'] = 'GD2';
try this
$config['image_library'] = 'gd2';

and also what error you are getting while resizing image and also check the log also


Image resizing probelm - El Forum - 06-08-2009

[eluser]MianUsman[/eluser]
same result image uploaded in destination folder but not resized any thing else that i m missing?


Image resizing probelm - El Forum - 06-08-2009

[eluser]umefarooq[/eluser]
hmmm check you destination folder path, you have to little debug

$config['new_image'] = $source_image_path.'thumbs/'.$new_image_name.'_'.$source_image_name;

print_r($config); die();

should be some path problem than use the following

$config['new_image'] = $source_image_path.'/thumbs/'.$new_image_name.'_'.$source_image_name;


Image resizing probelm - El Forum - 06-08-2009

[eluser]MianUsman[/eluser]
its printing array fine but not resizing any thing else that i have to do Smile