PHP函数:imagefttext不允许HTML

I don't know if there is another function in the GD library, but I tried researching through their documentation. Anyway, seems as if the imagefttext() function doesn't support html, just plain text.

$text = '<strong>Your Price:</strong><br />$'.$promo_data['selling_price'];

    @imagefttext($image, 12, 0, 163, 30, $color, '../images/gdprac/LUCIDASANSSTD.OTF', $text);

It just outputs the html tags and doesn't translate it to HTML. Is there any other function that allows HTML or anyway to bypass this using this function?

Thank you!

imagefttext can only draw plain text to an image, HTM is not supported.

If what you want to to outpout BOLD text to the image, you either use a bold font, or try this trick:

<?php
function drawboldtext($image, $size, $angle, $x_cord, $y_cord, $r, $g, $b, $fontfile, $text) 
{ 
   $color = ImageColorAllocate($image, $r, $g, $b); 
   $_x = array(1, 0, 1, 0, -1, -1, 1, 0, -1); 
   $_y = array(0, -1, -1, 0, 0, -1, 1, 1, 1); 
   for($n=0;$n<=8;$n++) 
   { 
      ImageTTFText($image, $size, $angle, $x_cord+$_x[$n], $y_cord+$_y[$n], $color, $fontfile, $text); 
   } 
} 
?>

The gd functions have nothing to do with HTML.

If you want to make text bold or italic then supply the corresponding font file as an argument, for example:

imagefttext($image, ..., '../images/gdprac/LUCIDASANSSTD-Bold.OTF', $text);

If you want to lay out text (combine bold with normal, write in "lines") you will have to manually calculate the position of all text output yourself: imageftbbox will let you know how much space the text will take up, and you will use this information to calculate where the next piece of text should go.