Fix for ww

This commit is contained in:
Thibault Richy 2019-03-12 15:49:26 +01:00
parent 427b5e765a
commit c101b2b980

View file

@ -118,17 +118,29 @@ trait GenerateBR {
// ---- Inscription produit valable
$textReduc = $coupon->coupon_validity_text;
$ImageFond = imagecreate(387, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$textReducs = explode("\r\n", $textReduc);
$y = 14;
foreach ($textReducs as $textReduc) {
$this->imagettftextSp($ImageFond , 12 , 0, 0, $y, $black, $arialbd, $textReduc, 0.01);
$y= $y+18;
if(strlen($textReduc) < 100) {
$ImageFond = imagecreate(387, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$textReducs = explode("\r\n", $textReduc);
$y = 14;
foreach ($textReducs as $textReduc) {
$this->imagettftextSp($ImageFond , 12 , 0, 0, $y, $black, $arialbd, $textReduc, 0.01);
$y= $y+18;
}
} else {
$ImageFond = imagecreate(387, 200);
$white = imagecolorallocate($ImageFond, 255, 255, 255);
$black = imagecolorallocate($ImageFond, 0, 0, 0);
$textReducs = explode("\r\n", $textReduc);
$y = 14;
foreach ($textReducs as $textReduc) {
$this->imagettftextSp($ImageFond , 10 , 0, 0, $y, $black, $arialbd, $textReduc, 0.01);
$y= $y+12;
}
}
//imagettftext($ImageFond , 12 , 0, 0, 14, $black, $arialbd, $textReduc);
imagecolortransparent($ImageFond, $white);
imagecopy($mask, $ImageFond, 360, 170, 0, 0, imagesx($ImageFond), imagesy($ImageFond));