greatqn 发表于 2011-9-14 11:06:10

遇到"图像 ... 因其本身有错无法显示。"

代码如下:

public function thumb()
{
header("Content-type: text/html;charset=utf-8");
$config['image_library'] = 'gd2';
$config['source_image'] = './'.$this->input->get('path');
$config['create_thumb'] = TRUE;
$config['thumb_marker'] = '';
$config['maintain_ratio'] = TRUE;
$config['width'] = 75;
$config['height'] = 50;
$config['dynamic_output'] = TRUE;
$this->load->library('image_lib', $config);
if ( ! $this->image_lib->resize())
{
    echo $this->image_lib->display_errors();
}
}



是个动态缩略的方法,刚写好的时候,是正常的,今天用的时候,不行了。页面显示:图像 ... 因其本身有错无法显示。
排查3小时。。。
最后锁定根目录的index.php文件,原文件ansi编码时,正常。文件编码改成utf-8时,异常。

不明所以,求解。

jeongee 发表于 2011-9-14 11:31:04

请修改成utf8无bom格式

Hex 发表于 2011-9-14 11:36:38

utf-8 有 BOM 吧?
去掉 BOM 就正常了。

greatqn 发表于 2011-9-14 14:08:09

去掉 BOM 就正常了。

是啊,怎么忘了这该死的bom!
页: [1]
查看完整版本: 遇到"图像 ... 因其本身有错无法显示。"