Re: problem with imagefontwidth function, It looks to be unavailable...

From: Date: Thu, 07 Feb 2008 13:23:22 +0000
Subject: Re: problem with imagefontwidth function, It looks to be unavailable...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-268867@lists.php.net to get a copy of this message
Legolas wood schreef:
Hi Thank you for reading my post I am trying to run a php based application using php5 and apache. but I receive an error like: *Fatal error*: Call to undefined function imagefontwidth() in */var/www/v603/includes/functions.php* on line *28*
that would tend to indicate that it's unavailable yes. you don't have the [php] GD extension loaded (and probably not even installed) php.net/gd mostly likely you'll have to ask your sys admin to install/activate this extension ... and if you have cheaphosting then likely the answer will be "no we don't do that" - in which case find other hosting?
when line 28 and its surrounding lines are: ## create an image not a text for the pin
    $font  = 6;
    $width = imagefontwidth($font) * strlen($generated_pin);
    $height = ImageFontHeight($font);
    $im = @imagecreate ($width,$height);
    $background_color = imagecolorallocate ($im, 219, 239, 249); //cell background
    $text_color = imagecolorallocate ($im, 0, 0,0);//text color
    imagestring ($im, $font, 0, 0,  $generated_pin, $text_color);
    touch($image_url . 'uplimg/site_pin_' . $full_pin . '.jpg');
    imagejpeg($im, $image_url . 'uplimg/site_pin_' . $full_pin . '.jpg');
    $image_output = '<img src="' . $image_url . 'uplimg/site_pin_' . $full_pin . '.jpg">';
    imagedestroy($im);
    return $image_output;
Can you tell me what is wrong with this code and how I can resolve the problem. Thanks


« previous php.general (#268867) next »