Basically, when I draw text, it ends in black as follows: http://i.stack.imgur.com/z675F.png
Instead of color, I stand out in PHP and functions. The code:
$finalImage = imagecreatefrompng($imageFile);
$logo = imagecreatefrompng($logoImage);
imagecopy($finalImage, $logo, $logoPosition['x'], $logoPosition['y'], 0, 0, imagesx($logo), imagesy($logo));
$font = "arial.ttf";
$fontSize = 10;
$yOffSet = 15;
$white = imagecolorallocate($finalImage, 255, 255, 255);
foreach($pixelArray as $key => $x) {
foreach($valueArray[$key] as $valueText) {
imagettftext($finalImage, $fontSize, 0, $x, $yOffSet, $white, $font, $valueText);
$yOffSet += 15;
}
$yOffSet = 15;
}
if($miscText != null) {
foreach($miscText as $key => $text) {
imagettftext($finalImage, $fontSize, 0, $text['x'], $text['y'], $white, $font, $text['text']);
}
}
imagepng($finalImage,$saveFileName.".png");
imagedestroy($finalImage);
He worked before, but then he just stopped, and I don’t know why. This was after I changed the original image (created beautiful), and I did not touch the code. I tried all kinds of things with changing colors, but I can not make it appear in anything other than black.
source
share