有人可以告诉我我的代码有什么问题吗?它可以上传图片,但无法创建150x150缩略图。它在我的localhost中运行良好,但在将其转移到cpanel之后似乎有问题。
这是我上传图片和创建缩略图的代码:
function upload() {
$config = array(
'upload_path' => $this->gallery_path,
'allowed_types' => 'jpeg|jpg|png|gif|bmp',
'max_size' => 2000
);
$this->load->library('upload', $config);
$this->upload->do_upload();
$image_data = $this->upload->data();
$config = array(
'source_image' => $image_data['full_path'],
'new_image' => $this->gallery_path . '/thumbnails',
'maintain_ratio' => TRUE,
'width' => 150,
'height' => 150
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$data['image'] = $image_data['file_name'];
$this->db->where('ID', $this->session->userdata('userID'));
$query = $this->db->update('member', $data);
return $query;
}
任何帮助将不胜感激。提前谢谢。