[Support request] Avatar initials generation fails as size parameter is empty in url

    • February 19, 2026 at 1:33 am #25044

      When using the Initials avatar mode in osTicket Awesome theme, the avatar generation fails with a fatal error:

      Fatal error: Uncaught ValueError: imagecreatetruecolor(): Argument #1 ($width) must be greater than 0

      Root cause:

      The LocalAvatar::getUrl() method only adds the size parameter to the URL when $this->size is truthy. However, when getAvatar() is called without a size parameter (e.g., <?php echo $user->getAvatar(); ?> in templates), $this->size becomes an empty string “” rather than null.

      When the empty string is passed to the avatar URL, PHP’s (int) “” converts it to 0, which the GD library’s imagecreatetruecolor() cannot accept.

      Example problematic URL: avatar.php?uid=1&mode=initials&size=&name=Casper+

      We are running 1.8.3

You must be logged in to reply to this topic.