用户
 找回密码
 入住 CI 中国社区
搜索
查看: 12452|回复: 3
收起左侧

[已解决] 遇到"图像 ... 因其本身有错无法显示。"

[复制链接]
发表于 2011-9-14 11:06:10 | 显示全部楼层 |阅读模式
代码如下:
PHP复制代码
 
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时,异常。

不明所以,求解。
发表于 2011-9-14 11:31:04 | 显示全部楼层
请修改成utf8无bom格式

评分

参与人数 1威望 +3 收起 理由
greatqn + 3 赞一个!

查看全部评分

发表于 2011-9-14 11:36:38 | 显示全部楼层
utf-8 有 BOM 吧?
去掉 BOM 就正常了。

评分

参与人数 2威望 +1 收起 理由
greatqn + 4 很给力!
jeongee -3 抄袭楼上,娃哈哈

查看全部评分

 楼主| 发表于 2011-9-14 14:08:09 | 显示全部楼层
去掉 BOM 就正常了。

是啊,怎么忘了这该死的bom!

本版积分规则