我使用 zend barcode
生成 barcode
并在 kohana 3.3.1 controller
中将其输出,它看起来像这样 .
<?php defined('SYSPATH') or die('No direct script access.');
class Controller_Barcode extends Controller_Base {
public function after()
{
$this->response->headers('Content-Type','image/gif');
parent::after();
}
public function action_Letter()
{
Helper_Barcode::generate_barcode(Enum_Post::LETTER);
}
}
它在视图网站上运行良好,但当我在 mpdf view
中使用它时:
<div><img src="/Barcode/Letter"></div>
它给了我错误:
mPDF error: IMAGE Error (/Barcode/Letter): Error parsing image file - image type not recognised, and not supported by GD imagecreate
谁知道可能有什么问题?
1 回答
我也有问题解析图像到mPDF库víaPOST或进行AJAX调用 . 当我发送一些带有标签的HTML字符串时,它显示以下错误:
“mPDF错误:IMAGE错误(http://www.xxxxxx.com/folder/my_image.jpg):解析图像文件时出错 - 图像类型无法识别,GD imagecreate不支持”
我的解决方案是,不是在我的HTML代码中发送标签,而是发送自定义标识符,如:
然后,在将使用mPDF的PHP中,我用正确的标记替换了该自定义代码:
它奏效了!
希望这可以帮助!