[Pardus-kullanicilari] PHP gd kütüphanesi + font dizini

Değer Muharrem PardusTestcisi at f2s.com
30 Ara 2008 Sal 16:16:15 EET


On Saturday 27 December 2008 22:23:13 Enes Genç wrote:
> Merhaba arkadaşlar
> Pardus sürümüm 2008.1
> Yerelde apache php kurulu.Php diğer durumlarda normal çalışıyor. sitemin
> olduğu sunucuda aşağıdaki kodu çalıştırdığımda düzgün çalışıyor. yerelde
> denediğimde ise "http://localhost/~enes/gd.php?yazi=enes" grafik dosyası
> hatalı olduğu için gösterilemiyor. şeklinde bir hata alıyorum.
>
>
> http://karalamakagidi.com/gd.php?yazi=enes
> adresine yüklediğim kod ise düzgün çalışıyor.
> Aşağıdaki kodda gd kütüphanesi kullanıyorum. PHP info'da gd kütüphanesinin
> kurulu olduğu yazıyor. Nerede hata olduğunu anlayamadım.  Nerede hata
> olduğunu anlayamadım.
>
>  Font ile ilgili bir problem olduğunu da düşünmeden edemiyorum. Pardusta
> font lar nerededir? fontun yerini nasıl gösterirsem daha doğru olur?
>
> Görüşlerinizi bekliyorum.
>
> <?php
>  header('Content-type: image/png');
>
>  $im = imagecreatetruecolor(125, 16);
>
>  $white = imagecolorallocate($im, 255, 255, 255);
>  $black = imagecolorallocate($im, 0, 0, 0);
>  imagefilledrectangle($im, 0, 0, 124, 15, $white);
>
>  if (!empty($_GET["yazi"])) $text = $_GET["yazi"];
>  else return 0;
>
>  imagettftext($im, 10, 0, 0, 12, $black, 'arial.ttf', $text);
>
>  imagepng($im);
>  imagedestroy($im);
>  ?>

Şöyle öntanımlı kurul gelen apache ve PHP ile çalışan bir örnek yollayabilirim 
size:

<?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);
imagefilledrectangle($im, 0, 0, 399, 29, $white);
// The text to draw
$text = 'Testing...';
// Replace path by your own font path: Pardus'ta bu dizin ve dosya var
$font = '/usr/share/fonts/dejavu/DejaVuSerif.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);
?>

kaynak:
http://uk3.php.net/manual/en/function.imagettftext.php

İyi çalışmalar,
Değer


Pardus-kullanicilari mesaj listesiyle ilgili daha fazla bilgi