0
好吧,当我尝试执行该程序,检索GD错误:Drupal_set_header返回错误
Function foo()
{
$file_name = 'image1.jpg';
$type = 'image/jpeg';
drupal_set_header('Content-Type:'.$type);
drupal_set_header('Content-Length: ' . filesize($file_name));
readfile($file_name);
}
错误:
The image http://192.168.1.190/parsegard/trackback/check/perm?pic=sites/default/files/imagecache/large/content_types/food_nutrition/2470/image1.jpg becuase it contains errors.
我尝试'的error_reporting(0); @函数ini_set(“display_errors设置”,0);'但它包含错误阿恩,我用这个routin在一个简单的PHP文件,它工作正常。 – bizzr3 2012-03-03 08:47:33
@bizzare:问题很可能是图像不是唯一发送给客户端的数据。暂时删除'readfile()'并将'Content-Type'设置为'text/plain'来查看阻碍图像的内容。请注意,即使是单个空格或换行符也可能是罪魁祸首! – 2012-03-03 09:00:15
好吧,我这样做,并发现一个空间时,将内容类型更改为纯文本,我怎么能删除该空间或干净的标题输出? – bizzr3 2012-03-03 10:09:10