【发布时间】:2017-09-14 10:55:43
【问题描述】:
Gd2 也已启用。试过很多方法...不知道怎么回事
遇到 PHP 错误 严重性:通知 消息:getimagesize():读取错误! 文件名:库/Image_lib.php 行号:1651
回溯: 文件:/opt/lampp/htdocs/ciflix/application/controllers/Admin.php 行:52 功能:库文件:/opt/lampp/htdocs/ciflix/index.php 行:315
函数:require_once
提供的图片无效。
您的服务器不支持处理此类图像所需的 GD 功能。
$config['upload_path'] = $path;
$config['allowed_types'] = $allowed_types;
$config['max_size'] = 15000;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if(!$this->upload->do_upload('userfile')){
$this->session->set_flashdata('file_error', $this->upload->display_errors());
redirect('admin/create_blog');
}else{
$data = $this->upload->data('userfile');
$config['image_library'] = 'gd2';
$config['source_image'] = $path.$data['userfile'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = FALSE;
$config['width'] = 200;
$config['height'] = 200;
$config['new_image'] = $path.$data['userfile'];
$this->load->library('image_lib', $config);
if(!$this->image_lib->resize()){
echo $this->image_lib->display_errors();
exit();
} else {
echo "Working";
exit();
}
$post_image = $_FILES['userfile']['name'];
}
【问题讨论】:
-
你应该从
php.ini启用GD扩展 -
你重启了apache2吗?
-
做了但没用 extension=php_gd2.dll
-
是的。重新启动。
-
现在可以了吗?
标签: php codeigniter codeigniter-3 image-resizing gd2