49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* Module My Easy ERP Web In Color
|
|
*
|
|
* @author Web In Color - addons@webincolor.fr
|
|
* @version 2.6
|
|
* @uses Prestashop modules
|
|
* @since 1.0 - mai 2014
|
|
* @package Wic ERP
|
|
* @copyright Copyright © 2014, Web In Color
|
|
* @license http://www.webincolor.fr
|
|
*/
|
|
|
|
require_once _PS_MODULE_DIR_.'wic_erp/classes/library/ean13/BCGFontFile.php';
|
|
require_once _PS_MODULE_DIR_.'wic_erp/classes/library/ean13/BCGColor.php';
|
|
require_once _PS_MODULE_DIR_.'wic_erp/classes/library/ean13/BCGDrawing.php';
|
|
require_once _PS_MODULE_DIR_.'wic_erp/classes/library/ean13/BCGean13.barcode.php';
|
|
|
|
class ErpEan13 extends ObjectModel
|
|
{
|
|
public function __construct($ean13)
|
|
{
|
|
if (strlen($ean13) == 13) {
|
|
$font = new BCGFontFile(_PS_MODULE_DIR_.'wic_erp/views/fonts/Arial.ttf', 18);
|
|
$colorFront = new BCGColor(0, 0, 0);
|
|
$colorBack = new BCGColor(255, 255, 255);
|
|
|
|
// Barcode Part
|
|
$code = new BCGean13();
|
|
$code->setScale(2);
|
|
$code->setThickness(30);
|
|
$code->setForegroundColor($colorFront);
|
|
$code->setBackgroundColor($colorBack);
|
|
$code->setFont($font);
|
|
$code->parse($ean13);
|
|
|
|
// Drawing Part
|
|
$drawing = new BCGDrawing('', $colorBack);
|
|
$drawing->setBarcode($code);
|
|
$drawing->draw();
|
|
|
|
$image = $drawing->get_im();
|
|
imagepng($image, _PS_MODULE_DIR_.'wic_erp/views/img/barcode/barcode_'.$ean13.'.png');
|
|
imagedestroy($image);
|
|
$drawing->destroy();
|
|
}
|
|
}
|
|
}
|