test other function space
This commit is contained in:
parent
08a829c8a6
commit
572eef43e9
1 changed files with 12 additions and 12 deletions
|
|
@ -50,7 +50,7 @@ trait GenerateBR {
|
|||
$y = 4;
|
||||
foreach ($lines_mentions as $line) {
|
||||
$y = $y +13;
|
||||
$this->imagettftextSp($ImageMentionFond , 7 , 0, (415/2)-(abs($boxMentions[4])-abs($boxMentions[6]))/2, $y, $black, $arial, $line, 0);
|
||||
$this->imagettftextSp($ImageMentionFond , 7 , 0, (415/2)-(abs($boxMentions[4])-abs($boxMentions[6]))/2, $y, $black, $arial, $line, 1);
|
||||
}
|
||||
|
||||
imagecolortransparent($ImageMentionFond, $white);
|
||||
|
|
@ -129,19 +129,19 @@ trait GenerateBR {
|
|||
return "generation/".$coupon->coupon_code.".png";
|
||||
}
|
||||
|
||||
function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0) {
|
||||
if ($spacing == 0) {
|
||||
function imagettftextSp($image, $size, $angle, $x, $y, $color, $font, $text, $spacing = 0)
|
||||
{
|
||||
if ($spacing == 0)
|
||||
{
|
||||
imagettftext($image, $size, $angle, $x, $y, $color, $font, $text);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
$temp_x = $x;
|
||||
$temp_y = $y;
|
||||
//to avoid special char problems
|
||||
$char_array = preg_split('//u',$text, -1, PREG_SPLIT_NO_EMPTY);
|
||||
foreach($char_array as $char) {
|
||||
imagettftext($image, $size, $angle, $temp_x, $temp_y, $color, $font, $char);
|
||||
$bbox = imagettfbbox($size, 0, $font, $char);
|
||||
$temp_x += cos(deg2rad($angle)) * ($spacing + ($bbox[2] - $bbox[0]));
|
||||
$temp_y -= sin(deg2rad($angle)) * ($spacing + ($bbox[2] - $bbox[0]));
|
||||
for ($i = 0; $i < strlen($text); $i++)
|
||||
{
|
||||
$bbox = imagettftext($image, $size, $angle, $temp_x, $y, $color, $font, mb_substr($text, $i, 1));
|
||||
$temp_x += $spacing + ($bbox[2] - $bbox[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue