I use this script to make html code into image using php-gd library:
<?php
//put your html code here
$html_code = '
<html>
<body>
Image Out Put sadadasdasdasdasdasd
</body>
</html>
';
$img = imagecreate("300", "600");
imagecolorallocate($img,0,0,0);
$c2 = imagecolorallocate($img,70,70,70);
imageline($img,0,0,300,600,$c2);
imageline($img,300,0,0,600,$c2);
$white = imagecolorallocate($img, 255, 255, 255);
imagettftext($img, 9, 0, 1, 1, $white, "arial.ttf", $html_code);
header('Content-type: image/jpeg');
imagejpeg($img);
?>
site url:
http://almogas.com/temp/phpimage.php?id=3
I get lot of unknown characters. How can I fix this behavior?
///////////////////////////////////////////////
edit
now its working after delete the spaces
but there is way to add background image? thank you