在这里我的控制器文件这工作正常,除了在拇指文件夹名称得到更改为converted_thumb的例子:我原来的图像名称是converted.jpg,但在拇指文件夹中,它保存为converted_thumb,所以我想从图像名称中删除_thumb,请解决这个问题
public function do_upload() {
$config['upload_path'] = './uploads'; // uploaded file store here
$config['allowed_types'] = 'jpg|png|jpeg|gif';
$config['max_size'] = ' 2097152';
$this->load->library('upload', $config);
if ($this->upload->do_upload()) {
$data = $this->upload->data();
//create copy of image
$configs['image_library'] = 'gd2';
$configs['source_image'] = $data['full_path'];
$configs['new_image'] = 'uploads/thumbs/'; //resize image will save here
$configs['create_thumb'] = 'false';
$configs['width'] = '250';
$configs['height'] = '250';
$this->load->library('image_lib', $configs);
$this->image_lib->resize();
$image_name = $data['file_name'];
//$full_path = $data['full_path'];
$post = array(
'product_name' => $image_name,
'product_path' => $configs['new_image'].$image_name
);
$this->db->insert('project', $post);
} else {
echo $this->upload->display_errors();
}
}
}
3条答案
按热度按时间svdrlsy41#
为什么你不喜欢那个大拇指?它就是用来做这个的。不管怎样,做这个。
nfg76nw02#
在
$configs
数组中尝试thumb_marker
。然后'_thumb'将不会添加到新创建的文件中。Source了解更多详细信息。
7z5jn7bk3#
只需将
thumb_marker
添加到您的config数组并将其设置为FALSE