Skip to content

[BUG]: Phalcon\Image\Adapter\Gd throwing an exception for the text function #15188

Closed
@nickweavers

Description

@nickweavers

Questions? Forum: https://phalcon.link/forum or Discord: https://phalcon.link/discord

Describe the bug
Phalcon\Image\Adapter\Gd throwing an exception for the text function
I have described the issue here and what I have done to investigate:
https://stackoverflow.com/questions/64541937/phalcon-image-adapter-gd-throwing-an-exception-for-the-text-function
But I think this must be a bug because I am calling the text function with the correct parameters as per the Phalcon 3.4 docs.

I have the following in my code:

use Phalcon\Image\Adapter\GD as Image;
...
    $imagePath = BASE_DIR . '/public/img/map-icons/' . $client->getId() . '/' . $file;
    $image = new Image($imagePath);
...
    $fontFile = $this->getFontPath();
    $image->text($text, $x, $y, 1, '#FFFFFF', $fontSize, $fontFile);

Under Phalcon 1.3.4 and php 5.4.45 it works fine, but when I migrated the application to a new server running Phalcon version 3.4.5 and php 7.3.17 the $image->text($text, $x, $y, 1, '#FFFFFF', $fontSize, $fontFile); is giving the following error:

Project staging.api.my-domain.com raised exception class Phalcon\lmage\Exception with message "Call to imagettfbboxO failed" at gd.zep, line 357

The literal values being passed to $image->text(..) are as follows:

$image->text(H, 9, 20, 1, '#FFFFFF', 11, '/var/www/vhosts/staging.api.mydomain.com/src/fonts/arialbd.ttf');

When I try the example for PHP's imagettfbbox given on the page here https://www.php.net/manual/en/function.imagettfbbox.php the example works and shows a white box with text written across it diagonally.

So it doesn't appear to be a problem with PHP imagettfbbox.

Details

  • Phalcon version: 3.4.5
  • PHP Version: 7.3.17
  • Operating System: Amazon Linux (an EC2)
  • Installation type: sudo yum-config-manager --enable remi-php73
  • Zephir version (if any):
  • Server: Apache
  • Other related info (Database, table schema):

Additional context
Here are the php extensions that are installed:

$ php -m
[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dbg
dom
exif
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
memcached
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
pdo_sqlite
phalcon
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
SPL
sqlite3
standard
sysvmsg
sysvsem
sysvshm
tokenizer
wddx
xml
xmlreader
xmlwriter
xsl
zip
zlib

Metadata

Metadata

Assignees

Labels

5.0The issues we want to solve in the 5.0 releasebugA bug reportstatus: lowLow

Type

No type

Projects

Status

Released

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions