gd - PHP imagefttext (imagettftext) not displaying anything -


I'm almost positive that this is a stupid reason that this is not working, but I can not understand it one. I'm just trying to print some text with a graphic as a graphic, but I can not find the word to display. This is on a GoDaddy server, so I do not control everything, but there are specs from phpinfo ():

  • PHP version 5.2.14
  • - With - Gd '' --with-freetype-dir = / usr '' --with-jpeg-dir = / usr '' --with-png-dir = / usr / bin / libpng-config '' --enable-gd
  • GD support enabled
  • GD version bundled (2.0.34 compatible)
  • Enable FreeType support
  • Linkage with FreeType FreeType
  • FreeType version 2.2.1

Here is the code I am using. Some fancy or not strange

  $ width = 270; $ Height = 25; $ Image = imageCreate ($ width, $ height); $ White = imageColorAllocate ($ image, 255, 255, 255); $ Black = imageColorAllocate ($ image, 0, 0, 0); $ Font = 'wdnana.tff'; Imagefttext ($ image, 16, 0, 0, 0, $ black, $ font, 'test text'); Header ("content-type: image / gif"); ImageGIF ($ image);  

I have tried to change the font name in different ways:

  $ font = './verdana.ttf'; $ Font = dirname (__file__). '/ Verdana.ttf'; I have tried to use PNG instead of GIF, I have tried using images using Fitext () and ImageText () I have tried to display errors, but it does not show any error, just one Any thoughts on blank screen? It should be something stupid ... 

I got it (it hurt my head) I am an expert on this for some time. ...)

The mistake was that offset offset font size to Y position Should appear

  & lt ;? Php $ width = 270; $ Height = 25; $ Image = imageCreate ($ width, $ height); $ White = imageColorAllocate ($ image, 255, 255, 255); $ Black = imageColorAllocate ($ image, 0, 0, 0); $ Font = 'WordNet.tf'; Fictional picture ($ image, 16, 0, 0, 16, $ black, $ font, 'test text'); Header ("content-type: image / gif"); ImageGIF ($ image); ? & Gt;  

Comments