login  Naam:   Wachtwoord: 
Registreer je!
 Forum

GD Plaatje tekst

Offline GroundZero - 15/12/2011 17:38
Avatar van GroundZeroLid Beste,

kan iemand mij vertellen waarom mijn tekst niet op het plaatje komt? het plaatje zelf zie ik wel maar geen tekst 

  1. // start a new image
  2. $image = imagecreatetruecolor(540, 230);
  3. // use this picture as background
  4. $image = imagecreatefrompng("background.png");
  5. // set some font colors
  6. $color = imagecolorallocate($image, 51, 51, 66);
  7. // set some fonts
  8. $font = 'tahoma.ttf';
  9.  
  10. // text, add name
  11. imagettftext($image, 18, 0, 10, 10, $color, $font, 'xxx');
  12.  
  13.  
  14. // create the image
  15. imagepng($image, 'test.png', 9);
  16. // free up memory resources
  17. imagedestroy($image);

2 antwoorden

Gesponsorde links
Offline Sam - 15/12/2011 17:46
Avatar van Sam PHP expert "Depending on which version of the GD library PHP is using, when fontfile does not begin with a leading / then .ttf will be appended to the filename and the library will attempt to search for that filename along a library-defined font path. "

Het zou dus kunnen dat er naar tahoma.ttf.ttf gezocht word.

1. Bestaat tahoma.ttf?
2. Probeer eens $font = '/tahoma.ttf';
Offline GroundZero - 15/12/2011 17:48 (laatste wijziging 15/12/2011 17:57)
Avatar van GroundZero Lid yeah heb ik gedaan haha maar het biedt helaas geen uitkomst ; ;
Heb het volgende geprobeerd:

$font = 'http://www.directory-bla-bla-bla.nl/mapje/arial.ttf';
$font = 'arial.ttf';
$font = '/arial.ttf';
$font = 'arial';

tahoma.ttf staat in de zelfde map als het index.php bestand waar de code in staat. Voor de gekkigheid heb ik arial.ttf ook toegevoegd en het daarmee geprobeerd maar ook dan geen tekst helaas.

http://www.devb...ite/avatar/

Plaatje word wel geladen...

http://www.devb...r/test.png

  1. <?php
  2. // start a new image
  3. $image = imagecreatetruecolor(540, 230);
  4. // use this picture as background
  5. $image = imagecreatefrompng("background.png");
  6. // set some font colors
  7. $color = imagecolorallocate($image, 51, 51, 66);
  8. // text, add name
  9. imagettftext($image, 18, 0, 10, 10, $color, 'arial.ttf', 'THIS IS A SAMPLE TEXT, THIS IS A SAMPLE TEXT');
  10. // create the image
  11. imagepng($image, 'test.png', 9);
  12. // free up memory resources
  13. imagedestroy($image);
  14. ?>
Gesponsorde links
Je moet ingelogd zijn om een reactie te kunnen posten.
Actieve forumberichten
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.172s