Is there a free (or commercial) PHP library which would help me convert a piece of HTML to image?
I googled it but haven't found anything.
thanks in adv
Is there a free (or commercial) PHP library which would help me convert a piece of HTML to image?
I googled it but haven't found anything.
thanks in adv
if you use the gd library you can use imagettftext function http://php.net/manual/en/function.imagettftext.php to generate images based on text.
You can follow the installation instructions for GD library at http://www.php.net/manual/en/image.installation.php
For example
$htmlstring = "<h1>Test</h1>;
$image = imagecreatefrompng("../images/image.png"); //create image
$black = imagecolorallocate($image, 0, 0, 0); // set colour of text
$font = 'CALISTBI.TTF'; // set the font (any true type font path on the server)
imagettftext($image, 19, 1, 36, 23, $black, $font, $htmlstring);