╰↓①秒つ. 发表于 2011-12-5 19:08:16

关于处理图片时的权限问题

我做图片缩略图的时候提示The path to the image is not correct.

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

百度翻译了一下是:图像的路径是不正确的,你的服务器不支持的功能需要处理这类图像。

我在控制器里的代码是:public function Welcome()
        {
         
                 parent::__construct();
                 $this->load->helper('url');
                
      
        }
       
        public function index(){
                $this->load->helper('url');
                $config['image_library'] = 'gd2';
$config['source_image'] = '/images/2.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 50;
$config['height'] = 50;
$this->load->library('image_lib', $config);

if($this->image_lib->resize()){
echo "ok";
$this->load->view('file');}
else{
          echo $this->image_lib->display_errors();

        $this->load->view('file');
}
               
               
        }
images文件是在根目录下的啊,2.jpg也存在。是不是我没有开启images文件夹的可写权限啊?怎么开启呢?

求解答

╰↓①秒つ. 发表于 2011-12-5 19:08:50

在线急等啊
:'(

qi_ruo 发表于 2011-12-5 20:00:05

本帖最后由 qi_ruo 于 2011-12-5 20:02 编辑

$config['source_image'] = '/images/2.jpg';估计是这个问题,你改成'images/2.jpg' 试试(相对于网站根目录)或改成绝对路径/var/www/......什么的

╰↓①秒つ. 发表于 2011-12-5 20:21:11

qi_ruo 发表于 2011-12-5 20:00 static/image/common/back.gif
$config['source_image'] = '/images/2.jpg';估计是这个问题,你改成'images/2.jpg' 试试(相对于网站根目 ...

没用的,我试过了。而且我让一个朋友复制到他那里去试试,结果跟我一样,是不是代码写错了?

╰↓①秒つ. 发表于 2011-12-7 21:47:05

问题搞定了,问题就是出在路径上

987543611 发表于 2012-2-25 15:09:32

需要 类似于 ./images/aaa.jpg    其中./为根目录

。笨才~ 发表于 2012-8-17 17:56:12

PHP CI框架 CodeIgnite交流 256269683

。笨才~ 发表于 2012-8-17 18:05:58

256269683 PHP CI框架 CodeIgnite交流群

。笨才~ 发表于 2012-8-17 18:06:13

256269683 PHP CI框架 CodeIgnite交流群
页: [1]
查看完整版本: 关于处理图片时的权限问题