谁能帮助我, 我想在order_conf电子邮件中附加生成的条形码图像(png)
我首先生成条形码图像:
$barcodeobj = new TCPDFBarcode($order->order_barcode, 'C128');
$barcode = base64_encode($barcodeobj->getBarcodePNG(1, 30, array(255,255,255)));
然后:
Mail::Send(
(int) $order->id_lang, 'order_conf',
Context::getContext()->getTranslator()->trans( 'Order confirmation', array(), 'Emails.Subject', $orderLanguage->locale ),
$data,
$this->context->customer->email,
$this->context->customer->firstname . ' ' . $this->context->customer->lastname,
null,
null,
$barcode,
null,
_PS_MAIL_DIR_,
false,
(int) $order->id_shop
);
我也尝试像这样附加它,但是我没有用:
$extra_pdf = array();
$extra_pdf['content'] = $barcode.'.png';
$extra_pdf['name'] = 'barcode.png';
$extra_pdf['mime'] = 'image/png';
答案 0 :(得分:0)
您需要获取图像的内容:
$content = file_get_contents(_PS_ROOT_DIR_.'/your_img_barcode_folder/'.$barcode.'.png');
来源: http://prestacraft.com/send-custom-template-email-with-attachment-and-variables-in-prestashop/#
或者您也可以在电子邮件模板中创建一个简单的$ link