Png transparan sorunu PHP metin dozajda

0 Cevap php

Ben bunun etrafında koyu bir sınır koyar yaptığınızda, ancak ben neden emin değilim, bir png üzerine metin yazmak çalışıyorum.

Orijinal görüntü:

Işlenmiş görüntü:

Kod:

// Load the image
$im = imagecreatefrompng("admin/public/images/map/order/wally.png");

// If there's an error, gtfo
if(!$im) {
    die("");
}
$textColor = imagecolorallocate($im, 68, 68, 68);

$width = imagesx($im);
$height = imagesy($im);

$fontSize = 5; 
$text = "AC";
// Calculate the left position of the text
$leftTextPos = ($width - imagefontwidth($fontSize)*strlen($text)) / 2;
// Write the string
imagestring($im, $fontSize, $leftTextPos, $height-28, $text, $textColor);
// Output the image
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);

Teşekkür ederiz!

0 Cevap