我再次抛出一个问题。我怎样才能找到new_image(Thumb)名称。 在控制器
//Insert image .............................
$config['upload_path'] = './img/placeholders/blog';
$config['allowed_types'] = 'gif|jpg|png';
$config['encrypt_name'] = TRUE;
$config['remove_spaces'] = TRUE;
$this->upload->initialize($config);
$this->upload->do_upload('blog_images');
//Thumb Image-----------------------------
$image_des = $this->upload->data();
$config['image_library'] = 'gd2';
$config['source_image'] = './img/placeholders/blog/' . $image_des['file_name'];
$config['maintain_ratio'] = TRUE;
$config['create_thumb'] = TRUE;
$config['new_image'] = './img/placeholders/blog/thumb/' . $image_des['file_name'];
$config['width'] = 220;
$config['height'] = 140;
$this->image_lib->initialize($config);
$this->image_lib->resize();
$image_dev = $this->upload->data();
// How Can i find new image name.
$data['blog_img'] = 'img/placeholders/' . $image_des['file_name'];
$data['blog_thumbs'] = ?
转换后,
blog_img名称为“ e7da891c90586f7c4e89ef5724891a15.jpg ”
blog_thumbs是“ e7da891c90586f7c4e89ef5724891a15_thumb.jpg ”
如何找到new_image(Thumb)名称。喜欢
$image_des['file_name']
答案 0 :(得分:0)
但你已经没事了!
$image_des['raw_name'] = 'e7da891c90586f7c4e89ef5724891a15'; //File name without extension.
$image_des['file_ext'] = '.jpg'; //The file extension with period
$data['blog_thumbs'] = 'your/preceding/path/'.
$image_des['raw_name'].'_thumb'.$image_des['file_ext'];
有关$this->upload->data()
的返回数组值的说明,请参阅file uploading class。