0

我又抛出了一个问题。我如何找到 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']

4

1 回答 1

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()

于 2013-04-29T04:10:52.100 回答