我对 codeigniter 很陌生,只是用它构建了我的第一个应用程序,但是在从图像生成缩略图时我有点难过。
图像正确上传,但拇指未生成,我没有收到任何错误:(
我希望有人能帮帮我,我可能只是一个山雀,而且它真的很简单,比如错误拼写 var。
这是我的图像模型的代码:
<?php
class Image_model extends CI_Model {
var $image_path;
function Image_model(){
parent::__construct();
$this->image_path = realpath(APPPATH.'../'.$this->config->item('dir_dynamic_images'));
}
function do_upload(){
$config = array(
'allowed_types' => "jpeg|gif|jpg|png",
'upload_path' => $this->image_path,
'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->image_path . '/thumbs',
'maintain_ratio' => true,
'width' => 200,
'height' => 200
);
echo $config['new_image'];
$this->load->library('image_lib', $config);
$this->image_lib->resize();
}
}
?>