Bug #75773 [NEW]: imgttftext not rendering text
From: dimante at jmgservices dot org
Operating system: Server 2012 R2
PHP version: 7.2.1
Package: GD related
Bug Type: Bug
Bug description:imgttftext not rendering text
Description:
------------
imgttftext is not rendering text on generated images. (This issue exists
on the 7.1 branch as well)
Test script:
---------------
<?php
// Set the content-type
header('Content-Type: image/png');
// Create the image
$im = imagecreatetruecolor(400, 30);
// 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 = '../e107_core/fonts/chaostimes.ttf';
// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);
// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);
// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>
Expected result:
----------------
Expected the graphic to be rendered with the text Testing...
Actual result:
--------------
Empty image was the result.
--
Edit bug report at https://bugs.php.net/bug.php?id=75773&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75773&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75773&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75773&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75773&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75773&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75773&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75773&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75773&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75773&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75773&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75773&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75773&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75773&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75773&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75773&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75773&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75773&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75773&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75773&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75773&r=mysqlcfg
Thread (5 messages)
- dimante at jmgservices dot org