Bug #75773 [Opn->Fbk]: imgttftext not rendering text

From: Date: Sun, 07 Jan 2018 18:15:37 +0000
Subject: Bug #75773 [Opn->Fbk]: imgttftext not rendering text
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-213408@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
 Updated by:         cmb@php.net
 Reported by:        dimante at jmgservices dot org
 Summary:            imgttftext not rendering text
-Status:             Open
+Status:             Feedback
 Type:               Bug
 Package:            GD related
 Operating System:   Windows Server 2012 R2
 PHP Version:        7.2.1
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

That looks like a duplicate of bug #75656.  Please check the
return value of imagettftext() and/or enable error_reporting to
show warnings.

As quick fix: call realpath() on the font file name.


Previous Comments:
------------------------------------------------------------------------
[2018-01-07 15:31:38] dimante at jmgservices dot org

More information can be found here:

https://github.com/e107inc/e107/issues/2956#issuecomment-355813801

------------------------------------------------------------------------
[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


Thread (5 messages)

« previous php.bugs (#213408) next »