Welcome Guest, Not a member yet? Register   Sign In
Trouble with resizing image
#5

[eluser]recoilme[/eluser]
inparo - right.
My problem was in gd2 and in wrong full path (for me). And wrong CI error reporting)
its work for me now:
Code:
function _upload_image($_FILES)
        {
            $this->load->library('upload');
            $this->load->library('image_lib');

            $config['upload_path'] = 'data/img/';
            $config['allowed_types'] = 'jpg|jpeg|gif|avi';
            $config['encrypt_name'] = 'TRUE';
            $this->upload->initialize($config);
            if ( ! $this->upload->do_upload()){
                $error = array('error' => $this->upload->display_errors());
                show_error($error);
            }
            $resarr = $this->upload->data();
            $file = $resarr['file_name'];

            if($file != '' and ($resarr['image_width']>780 or $resarr['image_height']>780) ){
                $config['image_library'] = 'GD2';
                $config['source_image'] = $resarr['full_path'];
                $config['maintain_ratio'] = TRUE;
                $config['width'] = 780;
                $config['height'] = 780;
                $config['master_dim'] = 'width';

                $this->image_lib->initialize($config);
                if ( ! $this->image_lib->resize()){
                    $error = array('error' => $this->image_lib->display_errors());
                    show_error($error);
                }
                $resarr['image_size_str'] = "width=\"780\"";
            }
            $upl = array();
            $upl = $resarr;
            return $upl;
        }


Messages In This Thread
Trouble with resizing image - by El Forum - 04-15-2008, 07:56 AM
Trouble with resizing image - by El Forum - 04-15-2008, 08:22 AM
Trouble with resizing image - by El Forum - 04-15-2008, 05:04 PM
Trouble with resizing image - by El Forum - 06-17-2008, 05:42 AM
Trouble with resizing image - by El Forum - 06-17-2008, 06:36 AM



Theme © iAndrew 2016 - Forum software by © MyBB