douhao 发表于 2013-3-26 15:27:14

image_lib的resize生成缩略图的时候不成功

$config['image_library'] = 'gd2';
$config['source_image'] = '/data/20130326070023_92872.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;

$this->load->library('image_lib', $config);

$this->image_lib->resize();
                        $this->image_lib->resize();
                        if ( ! $this->image_lib->resize())
                        {
                                echo $this->image_lib->display_errors();
                        }



运行后提示

The path to the image is not correct.Your server does not support the GD function required to process this type of image.Your server does not support the GD function required to process this type of image.Your server does not support the GD function required to process this type of image.

如果把$config['source_image'] 前面的“/”去掉就可以,这是怎么一回事?

caipeijie 发表于 2013-3-26 16:06:26

路径问题,建议用框架生成的绝对路径,
/data/20130326070023_92872.jpg

data/20130326070023_92872.jpg
这是两个完全不同的路径

caipeijie 发表于 2013-3-26 16:06:46

路径问题,建议用框架生成的绝对路径,
/data/20130326070023_92872.jpg

data/20130326070023_92872.jpg
这是两个完全不同的路径

douhao 发表于 2013-3-26 17:16:26

caipeijie 发表于 2013-3-26 16:06 static/image/common/back.gif
路径问题,建议用框架生成的绝对路径,
/data/20130326070023_92872.jpg



框架生成绝对路径是哪个函数?

mi19901218 发表于 2013-3-31 10:14:06

把整个ci放到根目录下,images文件夹放到ci下,调用的程序在controller中,为什么图像处理类的使用,source_image()中的路径只可以是‘images/1.jpg’,但是,‘../../images/1.jpg’,‘/ci/images/1.jpg’就不可以呢?
页: [1]
查看完整版本: image_lib的resize生成缩略图的时候不成功