CI2.0生成缩略图有问题,急求助,在线等。
CI2.0生成缩略图有问题,急求助,在线等。$config['image_library'] = 'gd2';
$config['source_image'] = './data/attachment/product/'.date("Ymd",time())."/".$imgname.".jpg";
$newimg_path = './data/attachment/product/'.date("Ymd",time())."/thumb";
if(!file_exists($newimg_path))
{
@mkdir($newimg_path,0700);
}
$config['new_image'] = $newimg_path."/".$imgname.'.jpg';
$config['create_thumb'] = TRUE;
$config['maintain_ratio'] = TRUE;
$config['width'] = 100;
$config['height'] = 100;
$this->load->library('image_lib',$config);
if(!$this->image_lib->resize()){
echo $this->image_lib->display_errors('<p>','<p>');
}
生成的缩略图不成功,没有生成缩略图。但是图片已经上传好了。
自己顶一个。代码是取自 CI2.0 缩略图的帮助手册。但是上传之后的图片没有生成缩略图。 问题已解决。
$this->image_lib->initialize($config);
不要忘了这一句。 $config['source_image'] = './data/attachment/product/'.date("Ymd",time())."/".$imgname.".jpg";
这句是错误的吧?可以自动生成文件夹的么? ╰↓①秒つ. 发表于 2011-12-7 21:45 static/image/common/back.gif
$config['source_image'] = './data/attachment/product/'.date("Ymd",time())."/".$imgname.".jpg";
这句 ...
我在上面还有个函数 是用于处理用户上传文件的。里面对这个路径有做处理。如果不存在就会创建。
if(!file_exists($file_path))
{
@mkdir($file_path);
}
这个帖子写的是关于缩略图处理部分的,所以代码没有完全贴出。不好意思哈……
页:
[1]