Note that there are some explanatory texts on larger screens.

plurals
  1. POPHP - imagettftext not working and GD installed
    text
    copied!<p>It's being long hours that I'm still looking for answer to this problem.. All the solutions I find are around catching the font name but I am pretty sure this isn't my problem.</p> <p><strong>It looks like GD is installed</strong></p> <pre><code>array(11) { ["GD Version"]=&gt; string(27) "bundled (**2.0.34 compatible**)" ["FreeType Support"]=&gt; bool(false) ["T1Lib Support"]=&gt; bool(false) ["GIF Read Support"]=&gt; bool(true) ["GIF Create Support"]=&gt; bool(true) ["JPEG Support"]=&gt; bool(true) ["PNG Support"]=&gt; bool(true) ["WBMP Support"]=&gt; bool(true) ["XPM Support"]=&gt; bool(true) ["XBM Support"]=&gt; bool(true) ["JIS-mapped Japanese Font Support"]=&gt; bool(false) } </code></pre> <p>Above you can see my GD support. My PHP version is 5.3 and I'm running on Linux.</p> <p>I have tried few different code examples from different websites and none works. ImageString does work for me but I need to get <strong>imagettftext</strong> to work..</p> <p>This is the last code I have tried now-</p> <pre><code>&lt;?php ini_set('display_errors', 1); error_reporting(E_ALL); // Set the content-type header('Content-Type: image/png'); // Create the image $im = imagecreatetruecolor(400, 100) or die("Can't create image!"); // Create some colors $white = imagecolorallocate($im, 255, 255, 255); $grey = imagecolorallocate($im, 128, 128, 128); $black = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 399, 29, $white); // The text to draw $text = 'Testing'; // Replace path by your own font path $font = 'arial.ttf'; // Add some shadow to the text imagettftext($im, 20, 0, 11, 21, $grey, 'arial.ttf', $text); // Add the text imagettftext($im, 20, 0, 10, 20, $black, 'arial.ttf', $text); // Using imagepng() results in clearer text compared with imagejpeg() imagepng($im); imagedestroy($im); ?&gt; </code></pre> <p><strong>Result:</strong> <a href="http://www.7679679.com/app/test-ansi.php" rel="nofollow">http://www.7679679.com/app/test-ansi.php</a></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload