how to write html on image using gd library php?
im using IMAGETTFTEXT function in php for writing text on some images.now i want to write html tags on my image,for example IMG tag. i dont know how to do that!i want help plz. here is my code :
$font_file = 'times.ttf';
$font_size=15;
$image_file= 'new.jpg';
$image = imagecreatefromjpeg($image_file);
$font_color = imagecolorallocate($image, 0, 0, 0);
imagettftext($ima开发者_StackOverflowge, $font_size, 0, 55, 30, $font_color, $font_file, "fhfghfghfghfg ");
imagettftext($image, $font_size, 0, 600, 30, $font_color, $font_file, "aaaaaaa ");
Header("Content-type: image/jpg");
imagejpeg($image);
imagedestroy($image);
There is no actual way to do this unless you write some kind of regular expression that replaces hyperlinks etc and creates an image from them.
Try using regular expressions and extracting useful data from the tags.
you need to use GD to created your <img>
sources or <div>
backgrounds and then output the HTML separately atop them. GD is pure pixel pumping
<?php ?>
<div style="background-image: url('/image.php')"><a href="http://example.com>a hyperlink</a></div>
image.php
header('Content-type: image/png');
$image = imagecreatetruecolor(...);
// GD generation stuff
imagepng($image);
精彩评论