php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45326 Call to undefined function imagettfbbox()
Submitted: 2008-06-21 10:31 UTC Modified: 2008-06-22 09:43 UTC
From: erickivuti at gmail dot com Assigned: pajoye (profile)
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2CVS-2008-06-21 (snap) OS: Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: erickivuti at gmail dot com
New email:
PHP Version: OS:

 

 [2008-06-21 10:31 UTC] erickivuti at gmail dot com
Description:
------------
I am using a catpha script on my site. The script works fine at home (EasyPHP 2 on WinXP). Once I upload to a host server, I get the error, given below. The code was obtained from a captcha plugin for Dreamweaver.

I have created a file with phpinfo(); at: http://smartpetitions.com/info.php

The page is:
http://smartpetitions.com/create.php

I have checked the reported bugs:
http://bugs.php.net/bug.php?id=19542
http://bugs.php.net/bug.php?id=21028

Reproduce code:
---------------
<?php // create.php
//...MISSING CODE..
function CaptchaImage($width='120',$height='30',$characters='6',$hex_bg_color='FFFFFF',$hex_text_color="FF0000",$hex_noise_color="CC0000", $img_file='captcha.jpg') {
  //...MISSING CODE..
  /* create textbox and add text */
  $textbox = imagettfbbox($font_size, 0, $this->font, $code); // LINE 57
  $x = ($width - $textbox[4])/2;
  $y = ($height - $textbox[5])/2;
  imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font , $code);
  /* save the image */
  //...MISSING CODE..
}
?>
<!-----MISSING CODE----------->
<td><div style="border:1px solid gray; padding:5px 5px; width:200px; text-align:center;">
  <?php $captcha = new CaptchaImage(150,50,5,'FFFFFF','003366','0099CC');?> 
  <img src="/images/refresh.gif" title="Refresh Code" onclick="captcha()" /><br />
  <div style="padding:4px 0px;">Enter the code and click 'Create':</div>
<!-----MISSING CODE----------->

Expected result:
----------------
Just like this page. A verification code. The code on the page works fine when tested offline on EasyPHP, Wamp or Xampp, on multiple PC's.

Actual result:
--------------
Fatal error: Call to undefined function imagettfbbox() in /home/smartpet/public_html/create.php on line 57

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-06-22 09:43 UTC] pajoye@php.net
You have to compile PHP-GD with Freetype support (--with-freetype-dir=/usr for example).
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 02 07:01:33 2025 UTC