Jump to content
php.lv forumi

Teksta uzrakstīšana uz bildes ar GD.


Vebers

Recommended Posts

Nezinu kapēc, bet uz severa negrib darboties imagettftext(); f-ja. Bilde parādas, tikai teksts uz tās kas paradzēts netiek uzrakstīts.

 

Piemērs no php.net

<?php
// Set the content-type
header("Content-type: image/png");

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);

// The text to draw
$text = 'Testing...';
// Replace path by your own font path
$font = $_SERVER['DOCUMENT_ROOT'].'/top/verdana.ttf';

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>

 

Safe mode = on

Link to comment
Share on other sites

errorus nerāda vienalga. :(

 

TrueType ir:

 

Array

(

[GD Version]=> bundled (2.0.28 compatible)

[FreeType Support] => 1

[FreeType Linkage] => with TTF library

[T1Lib Support] => 1

[GIF Read Support] => 1

[GIF Create Support] => 1

[JPG Support] => 1

[PNG Support] => 1

[WBMP Support] => 1

[XPM Support] =>

[XBM Support] => 1

[JIS-mapped Japanese Font Support] =>

)

 

hmm.. tad sanāk, ka tam verdana.ttf ir jabūt manā open_basedir ? Ievietoju, bet nekā..

Link to comment
Share on other sites

imagettftext(); ???

-----

This function requires both the GD library and the FreeType library.

---------------

siikaak

P.S. nesenaa pagaatnee (pats gan neko neprogrammeju tik paluudz helpu ) saskaros ar ko liidziigu ...

edit : nu ieksx www.php.net taksh ir iespejams mekleet peec preciizas f-jas ... vai tad gruuti ????

it iipashi ja ir aizdomas par kadu no f-jam?

Edited by Grey_Wolf
Link to comment
Share on other sites

a tev mājās viss šancē? Ja šancē, tad tiešām problēmas ar konfigu:

nav perm uz fontu vai to neatrod nezkāpēc

 

Un ieslēdz tu tos errorus... Ja nav iespējas konfigurēt serveri - tad uzraksti vai paņem gatavu Error handleri un bliez savā buferī, tad paskaties kas tur notiek...

Link to comment
Share on other sites

×
×
  • Create New...