Search Webmaster Help and Solution

imagettftext not working with trajanpro.ttf

Hi All,
I am getting this problem for one of my site that i am developing .
When I insert special characters string like this ~!@#$%^&*()_+| the code is unable to convert it into right image with all text on it when the chosen font in trajanpro.ttf, but when I change the font with Ariel it works fine.
If anyone want to check this problem then you can check at this link

http://www.centralstationery.com/produc ... ate_id=231

Click the text on card and a pop up will open and then change the font to Ariel then the image on card will be converted into right text.

The code is

imageSaveAlpha($image, true);
ImageAlphaBlending($image, false);
$bgcolor = imagecolorallocate($image, 200, 200, 200);
$transparentColor = imagecolorallocatealpha($image, 200, 200, 200, 127);
imagefill($image, 0, 0, $transparentColor);
// pick color for the text
$fontcolor = imagecolorallocate($image, $red, $grn, $blu);

// fill in the background with the background color
imagefilledrectangle($image, 0, 0, $width, $height, $transparentColor);
$x = 0;
$y = $fontsize;
imagettftext($image, $fontsize, 0, $bx, $by, $fontcolor, $font, $quote);


$final_image=DIR_USER_EDITOR.$new_image;

// output image to the browser
imagepng($image, $final_image);

// delete the image resource
imagedestroy($image);

Thanks in advance Hi All,
I am getting this problem for one of my site that i am developing .
When I insert special characters string like this ~!@#$%^&*()_+| the code is unable to convert it into right image with all text on it when the chosen font in trajanpro.ttf, but when I change the font with Ariel it works fine.
If anyone want to check this problem then you can check at this link

http://www.centralstationery.com/produc ... ate_id=231

Click the text on card and a pop up will open and then change the font to Ariel then the image on card will be converted into right text.

The code is

imageSaveAlpha($image, true);
ImageAlphaBlending($image, false);
$bgcolor = imagecolorallocate($image, 200, 200, 200);
$transparentColor = imagecolorallocatealpha($image, 200, 200, 200, 127);
imagefill($image, 0, 0, $transparentColor);
// pick color for the text
$fontcolor = imagecolorallocate($image, $red, $grn, $blu);

// fill in the background with the background color
imagefilledrectangle($image, 0, 0, $width, $height, $transparentColor);
$x = 0;
$y = $fontsize;
imagettftext($image, $fontsize, 0, $bx, $by, $fontcolor, $font, $quote);


$final_image=DIR_USER_EDITOR.$new_image;

// output image to the browser
imagepng($image, $final_image);

// delete the image resource
imagedestroy($image);

Thanks in advance

View Complete Thread with Replies

Related Items

Query failed: connection to localhost:3354 failed (errno=111, msg=Connection refused).