Ich versuche, Text auf ein PNG zu schreiben, aber wenn ich es mache, legt es einen dunklen Rand darum herum, ich bin nicht sicher, warum.Anwenden von Text auf PNG-Transparenzproblem PHP
Das Originalbild:
Das verarbeitete Bild:
Code:
// 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);
fantastisch, funktioniert vielen Dank: D – Titan
Gern geschehen! :) – Christian