Ваш сервер не поддерживает функцию GD, необходимую для обработки этого типа изображения. в Codeigniter - PullRequest
0 голосов
/ 04 июля 2018

enter image description here

Я пытаюсь сжать размер изображения в codeigniter с помощью библиотеки сжатия изображений GD2, но она показывает мне ошибку

Your server must support the GD image library in order to determine the image properties.

Your server does not support the GD function required to process this type of image.

Но на моем сервере он показывает, что GD включен

array(12) { ["GD Version"]=> string(26) "bundled (2.1.0 compatible)" ["FreeType Support"]=> bool(true) ["FreeType Linkage"]=> string(13) "with freetype" ["GIF Read Support"]=> bool(true) ["GIF Create Support"]=> bool(true) ["JPEG Support"]=> bool(true) ["PNG Support"]=> bool(true) ["WBMP Support"]=> bool(true) ["XPM Support"]=> bool(true) ["XBM Support"]=> bool(true) ["WebP Support"]=> bool(true) ["JIS-mapped Japanese Font Support"]=> bool(false) }

Вот мой код

$file_path = './public/order_images/';
        if($_FILES['image_name']['name']!="")
        {
            $config['upload_path']          = $file_path;
            $config['allowed_types']        = 'gif|jpg|png';
            // $config['max_size']             = 1000000;
            // print_r($config);exit;
            $this->load->library('upload', $config);
            $this->upload->initialize($config);
            if (!$this->upload->do_upload('image_name'))
            {
                $error = array('error' => $this->upload->display_errors());
                // print_r($error);exit;
            }
            else
            {

                $data = array('upload_data' => $this->upload->data());
                $zfile = $data['upload_data']['full_path']; // get file path
                chmod($zfile,0777); // CHMOD file

                $img_config['image_library']          = 'gd2';
                $img_config['source_image']          = $data['upload_data']['full_path'];
                $img_config['create_thumb']        = FALSE;
                $img_config['maintain_ratio']             = TRUE;
                $img_config['quality']             = '60%';
                $img_config['width']             = 150;
                $img_config['height']             = 75;
                $img_config['new_image']             = $_SERVER['DOCUMENT_ROOT'].'/public/order_new_img/new_'.$data['upload_data']['file_name'];
                // $this->resize($file_path,$data['upload_data']['file_name']);
                $size = filesize($data['upload_data']['full_path']);
                // pre($img_config);
                var_dump(gd_info());

                $this->load->library('image_lib');

                $this->image_lib->initialize($img_config);

                // $this->image_lib->resize();

                // pre(getimagesize($data['upload_data']['full_path']));
                if (!$this->image_lib->resize()){

                        echo $this->image_lib->display_errors();exit;

                    } else {

                        echo "done";exit;

                    }
                $this->image_lib->clear();
            }

            $image_name = $data['upload_data']['file_name'];
        }

Я также проверил в php.info, что он также показывает, что GD включен, но когда я нажимаю кнопку подтверждения, эта ошибка показывает

GD Не поддерживается

Пожалуйста, помогите мне найти решение

Спасибо за продвинутый

...