0

バーコードと各行の説明を含むテーブルを含むページを表示(および後で印刷)する必要があります。

私は

$result = $mySql->query->fetchAll();

適切なデータが含まれています。

最初に私は

$rendererOptions = array();
    foreach($result as &$res){
        $barcodeOptions = array(
                'text' => $res['myParam'],
                'rendererParams' => array('imageType' => 'gif'),);
        $res['barcode'] = Zend_Barcode::factory('CODE39', 'image', $barcodeOptions, $rendererOptions)->draw();
}

    $this->view->data = $result;

悪い結果になります。それから私は試してみました:

Zend_Barcode::render(....);

多くの組み合わせで、

$.post('/mycontroller/myactionthatrendersthebarcode',{code : this.id}, function(data){
            $(this).html(data);     });

私の.phtmlページ(ほとんどネットワークを殺している:D)

ドキュメント(http://framework.zend.com/manual/1.12/en/zend.barcode.creation.html)をたどると、1つだけですが、正しいバーコードまたは多数のリソースIDがわかりません。管理。

何かアドバイス?ありがとうございました

4

1 に答える 1

0

このdrawメソッドは、gd画像リソースを返します。画像を出力するには、次の操作を実行できます。

$rendererOptions = array();
$barcodeOptions = array(
    'text' => 'TEST',
    'rendererParams' => array('imageType' => 'gif'),
);
$resource = Zend_Barcode::factory('CODE39', 'image', $barcodeOptions, $rendererOptions)->draw();

header('Content-Type: image/gif');
imagegif($resource);
exit;

メソッドは自動的にそれrenderを行います:

$rendererOptions = array();
$barcodeOptions = array(
    'text' => 'TEST',
    'rendererParams' => array('imageType' => 'gif'),
);
Zend_Barcode::factory('CODE39', 'image', $barcodeOptions, $rendererOptions)->render();
exit;

imgタグで画像を出力したい場合は、上記をアクションに書き込んで呼び出す必要があります。たとえば、上記のスクリプトoutputActionImgController

<img src="/img/output">

動的に必要な場合は、get paramsをアクションに送信し、アクションのロジックを実行できます。

<img src="/img/output/text/TEXT">
<img src="/img/output/id/123">
于 2013-03-18T15:27:55.103 に答える