Bug #75773 [Opn]: imgttftext not rendering text
| From: | dimante at jmgservices dot org | Date: | Sun, 07 Jan 2018 15:31:39 +0000 |
| Subject: | Bug #75773 [Opn]: imgttftext not rendering text | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-213405@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=75773&edit=1
ID: 75773
User updated by: dimante at jmgservices dot org
Reported by: dimante at jmgservices dot org
Summary: imgttftext not rendering text
Status: Open
Type: Bug
Package: GD related
Operating System: Windows Server 2012 R2
PHP Version: 7.2.1
Block user comment: N
Private report: N
New Comment:
More information can be found here:
https://github.com/e107inc/e107/issues/2956#issuecomment-355813801
Previous Comments:
------------------------------------------------------------------------
[2018-01-07 15:29:09] dimante at jmgservices dot org
Specified Windows.
------------------------------------------------------------------------
[2018-01-07 15:25:49] dimante at jmgservices dot org
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 this bug report at https://bugs.php.net/bug.php?id=75773&edit=1