i have this code:

 $wap_image_filename = $wap_profile_pic."-wap.jpg";
 $image =0;
 if($mimetype=='IMAGE/PNG')
{
	 $image = imagecreatefrompng($profile_pic);
	 imagejpeg($image,$wap_image_filename , 100);
}
else if($mimetype=='IMAGE/JPG')
{
	$image = imagecreatefromjpeg($profile_pic);
	imagejpeg($image,$wap_image_filename , 100);
}

//resize photo with 100% quality
$this->resizeImage($profile_pic,$wap_image_filename,300,300,100);

$filename = $wap_image_filename;
$date_card_image = imagecreatetruecolor(400, 500);
//$date_card_image gives resource id

$bg_col = imagecolorallocate ( $date_card_image, 200, 200, 200 );
imagefill ( $date_card_image, 0, 0, $bg_col);

$source = imagecreatefromjpeg($filename);
//$source gives a resource id#

list($ppwidth, $ppheight) = getimagesize($filename);

// Resize
imagecopyresized($date_card_image, $source , 0, 40, 0,0, 400,  $ppheight, $ppwidth, $ppheight);

$uc_color 		= ImageColorAllocate ($date_card_image,10, 10, 10);
$info_color 	= ImageColorAllocate ($date_card_image,42, 134, 186);

$white = imagecolorallocate($date_card_image, 255, 255, 255);
$black = imagecolorallocate($date_card_image, 0, 0, 0);
$blue = imagecolorallocate($date_card_image, 0, 0, 128);
$font = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf';
$text = $this->getUniqueCode();

// Add the text
imagettftext($date_card_image, 24, 0, 55, 30, $blue, $font, $text);    [COLOR="Red"]//get warning on this line 227[/COLOR]

the warning i get is:
Warning: imagettftext(): Could not find/open font in /home/helloises/traffic_2/phoenix/plugins/rainbowCodePlugin/lib/model/RcProfileTable.php on line 227

please can some one help me fix this?
thank you

    As the error message states, PHP either couldn't find the font file you specified or it just couldn't open it (e.g. permissions issues or something like that).

    So... easy fix: either use a different font file that PHP can open, or else upload the font file you're attempting to use to a location that PHP can open it from.

      oops i see now: so i must either change the font: DejaVuSansCondensed-Bold.ttf'

      or move it to where php can fin it thus other than: /usr/share/fonts/truetype/ttf-dejavu

      so the line: $font = '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSansCondensed-Bold.ttf';
      must be changed...

      thank you for that!

        BTW: can you perhaps suggest a font other than DejaVuSansCondensed-Bold.ttf' ??? please?

          Write a Reply...