GD support - Create PNG


Hi, although png images are created, but NOT all text symbols are allow when doing so. The image fails.

According to the plugin I use, it is a lack of GD Support from the server.

I ran a test and here are the results, as you can see “Create PNG” is not in the list.

GD is supported by your server

GD Version - Yes
FreeType Support - Yes
FreeType Linkage - Yes
T1Lib Support - No
GIF Read Support - Yes
GIF Create Support - Yes
JPEG Support - Yes
PNG Support - Yes
WBMP Support - Yes
XPM Support - No
XBM Support - Yes
JIS-mapped Japanese Font Support - No

Do I need to do something to have PNG Create Support available?


The separation of “read” and “create” is unique to GD’s GIF support. All of the other listed image types are supported for both read and create, if they are supported at all.

Your problem is most likely that the font you’re using does not contain the symbols you are trying to use. What font are you using, and what symbols aren’t showing up?


I have no idea which font the plugin uses. It is a “Text Smilie” creator for phpbb. There is no manual font type selection

You just input the text you want and the plugin creates a smilie holding a sign with the text.

It only seems to allow letters, numbers and -

When ever using a . or , or ’ (it’s) and other non-text symbols, the plugins fails and just gives the bbcode in a post.

This is the only part I could find in the php-files that mention the font type:

$i = 0;
while ($i < sizeof($output))
	if (((!$gd_info["FreeType Support"]) || (!file_exists($fontfile))))
		if ($shadowcolor)
			imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $fontwidth) - 2) / 2 + 1), ($i * $fontheight + 6), trim($output[$i]), $txt2color);
		imagestring($img, 2, (($width - (strlen(trim($output[$i])) * $fontwidth) - 2) / 2), ($i * $fontheight + 5), trim($output[$i]), $txtcolor);
		if ($shadowcolor)
			imagettftext($img, $fontheight, 0, (($width - (strlen(trim($output[$i])) * $fontwidth) - 2) / 2 + 1), ($i * $fontheight + $fontheight + 7), $txt2color, $fontfile, trim($output[$i]));
		imagettftext($img, $fontheight, 0, (($width - (strlen(trim($output[$i])) * $fontwidth) - 2) / 2), ($i * $fontheight + $fontheight + 8), $txtcolor, $fontfile, trim($output[$i]));

It is not a real problem, but at least standard .,’ should be possible.
Maybe it is a plugin issue and does not work correct on phpbb 3.0.12 anymore.


GD can handle those characters, so it’s likely the plugin code.

test_gd_png.html :

<img src="">

test_gd_png.php :


<?php header ("Content-type: image/png"); $string = "PNG creation test: `',."; $font = 4; $width = imagefontwidth ($font) * strlen ($string); $height = imagefontheight ($font); $image = imagecreatetruecolor ($width,$height); $white = imagecolorallocate ($image,255,255,255); $black = imagecolorallocate ($image,0,0,0); imagefill ($image,0,0,$white); imagestring ($image,$font,0,0,$string,$black); imagepng ($image); imagedestroy ($image); ?>[/code]


That sounds like the bbCode parser is at fault here, not the image generation. (If the image generation was the problem, you’d be getting either a broken image, or an image with the characters missing.)


You are right, they used & instead of just & in the bbcode, so I changed it and now , . - _ can be used. Hyphen should also be possible, but still gives just the bbcode. a + symbol gives an empty space now

Anyway, this is what should be allowed and functioning:
Unicode letter characters, numbers, spaces, commas, dots, minus, plus, hyphen, underscore and whitespaces.

So only the Hyphen and Plus don’t work.