我想創建一個圖像從html,我不能使用painty,因爲它已經過時,不再工作,我想要類似的東西。 我已經嘗試使用GD庫這樣從html創建圖像
<?php
$html_code = "<b> this is the body </b> ";
// Create the image
$img = imagecreate("300", "600");
imagecolorallocate($img,0,0,0);
$c = 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);
// Display the image
header("Content-type: image/jpeg");
imagejpeg($img);
創建圖像,但它不「編譯」 html標籤和打印他們的圖像文本英寸
問候
您的意思是它打印'這是身體'?這很正常。這是Web瀏覽器呈現html標記的工作。在PHP文檔的imagettftext頁面上有一些提示。 http://php.net/manual/fr/function.imagettftext.php – Aif
'imagettftext'不會將HTML作爲輸入,而是純文本 - 所以你不能這樣做。 – Andris