我使用GD库,我试图添加一个HTML图像使用PHP回声。gd库 - 图像上的文本作为回声与html
<?php
$image = imagecreatefrompng("grafika.png");
$black = imageColorAllocate($image, 255, 255, 255);
$font = 'arial.ttf';
$text = 4;
if($text == 4) {
echo '<div style="background-color: yellow; width: 100px; height: 100px;">some text here</div>';
}
imagettftext($image, 16, 0, 50, 100, $black, $font, $text);
header("Content-type: image/png");
imagepng($image);
?>
我在做什么错? 有没有不同的方式来做到这一点?