Test format image

This commit is contained in:
Michael RICOIS 2018-03-08 16:29:11 +01:00
parent 490baf50f4
commit cab5635c8f
2 changed files with 8 additions and 9 deletions

View File

@ -505,6 +505,7 @@ class AdminLabelGenerate extends AdminTab
$quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']); $quantity += ($od['product_quantity'] - $od['product_quantity_reinjected']);
} }
if ($quantity > 0) { if ($quantity > 0) {
print_r($combination);
$barcode->generateIdentification($combination['id_product'], $combination['id_product_attribute'], $product->reference, $combination['attribute_name']); $barcode->generateIdentification($combination['id_product'], $combination['id_product_attribute'], $product->reference, $combination['attribute_name']);
$barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference); $barcode->assocProduct($combination['id_product'], $combination['id_product_attribute'], $quantity, $product->reference);
} }
@ -525,7 +526,7 @@ class AdminLabelGenerate extends AdminTab
} }
if ($quantity > 0) { if ($quantity > 0) {
$barcode->generateIdentification($combination['id_product'], null, $product->reference); $barcode->generateIdentification($product->id, null, $product->reference);
$barcode->assocProduct($product->id, null, $quantity, $product->reference); $barcode->assocProduct($product->id, null, $quantity, $product->reference);
} }
} }

View File

@ -121,6 +121,7 @@ class GenerateBarcode
{ {
$width = 320; $width = 320;
$height = 80; $height = 80;
$font = dirname(__FILE__).'/arial.ttf';
preg_match('/.*-(.*)-.*/', $reference, $matches); preg_match('/.*-(.*)-.*/', $reference, $matches);
$ref = $matches[1]; $ref = $matches[1];
@ -130,16 +131,13 @@ class GenerateBarcode
$white = ImageColorAllocate($im, 0xff, 0xff, 0xff); $white = ImageColorAllocate($im, 0xff, 0xff, 0xff);
imagefilledrectangle($im, 0, 0, $width, $height, $white); imagefilledrectangle($im, 0, 0, $width, $height, $white);
imagettftext($im, 11, 0, $width / 2, $height / 2 - 10, $black, dirname(__FILE__).'/arial.ttf', $ref); imagettftext($im, 30, 0, 10, 50, $black, $font, $ref);
if ($id_product_attribute !== null) { if ($id_product_attribute === null) {
imagettftext($im, 11, 0, $width / 2 - (strlen($attribute_ref)* 4), $height - 10 , $black, dirname(__FILE__).'/arial.ttf', $attribute_ref);
}
if ($id_product_attribute) {
$result = imagegif($im, $this->directory.'/id-'.$id_product.'-'.$id_product_attribute.'.gif');
} else {
$result = imagegif($im, $this->directory.'/id-'.$id_product.'-0.gif'); $result = imagegif($im, $this->directory.'/id-'.$id_product.'-0.gif');
} else {
imagettftext($im, 12, 0, 65, 50 , $black, $font, $attribute_ref);
$result = imagegif($im, $this->directory.'/id-'.$id_product.'-'.$id_product_attribute.'.gif');
} }
return $result; return $result;