• 28-08-2010, 22:41:17
    #1
    php gd kutupanesi ile bir resim oluşuşturdum ancak aşagı geçmeyi yapmadım /n filan dnedim olmadı ne yapabilirim?
  • 29-08-2010, 01:15:23
    #2
    \r\n

    eğer imagestring fonksiyonu varsa iş daha karmaşık
  • 29-08-2010, 11:28:45
    #3
    Deimosx adlı üyeden alıntı: mesajı görüntüle
    \r\n

    eğer imagestring fonksiyonu varsa iş daha karmaşık
    var
  • 29-08-2010, 12:08:09
    #4
    PHP Manual'dan bu kod;


    Desc: Same function as above but it can display multi-line strings.
    <?php
    function sendimagetext($text) {
      // Set font size
      $font_size = 4;
    
      $ts=explode("\n",$text);
      $width=0;
      foreach ($ts as $k=>$string) { //compute width
        $width=max($width,strlen($string));
      }
    
      // Create image width dependant on width of the string
      $width  = imagefontwidth($font_size)*$width;
      // Set height to that of the font
      $height = imagefontheight($font_size)*count($ts);
      $el=imagefontheight($font_size);
      $em=imagefontwidth($font_size);
      // Create the image pallette
      $img = imagecreatetruecolor($width,$height);
      // Dark red background
      $bg = imagecolorallocate($img, 0xAA, 0x00, 0x00);
      imagefilledrectangle($img, 0, 0,$width ,$height , $bg);
      // White font color
      $color = imagecolorallocate($img, 255, 255, 255);
    
      foreach ($ts as $k=>$string) {
        // Length of the string
        $len = strlen($string);
        // Y-coordinate of character, X changes, Y is static
        $ypos = 0;
        // Loop through the string
        for($i=0;$i<$len;$i++){
          // Position of the character horizontally
          $xpos = $i * $em;
          $ypos = $k * $el;
          // Draw character
          imagechar($img, $font_size, $xpos, $ypos, $string, $color);
          // Remove character from string
          $string = substr($string, 1);     
        }
      }
      // Return the image
      header("Content-Type: image/png");
      imagepng($img);
      // Remove image
      imagedestroy($img);
    }
    ?>
  • 29-08-2010, 13:37:59
    #5
    saol ben buna font yüklemeyi nasıl yapıcam?
    gd kütüphanesinden anlamamda
    bayGaReZ adlı üyeden alıntı: mesajı görüntüle
    PHP Manual'dan bu kod;


    Desc: Same function as above but it can display multi-line strings.
    <?php
    function sendimagetext($text) {
      // Set font size
      $font_size = 4;
    
      $ts=explode("\n",$text);
      $width=0;
      foreach ($ts as $k=>$string) { //compute width
        $width=max($width,strlen($string));
      }
    
      // Create image width dependant on width of the string
      $width  = imagefontwidth($font_size)*$width;
      // Set height to that of the font
      $height = imagefontheight($font_size)*count($ts);
      $el=imagefontheight($font_size);
      $em=imagefontwidth($font_size);
      // Create the image pallette
      $img = imagecreatetruecolor($width,$height);
      // Dark red background
      $bg = imagecolorallocate($img, 0xAA, 0x00, 0x00);
      imagefilledrectangle($img, 0, 0,$width ,$height , $bg);
      // White font color
      $color = imagecolorallocate($img, 255, 255, 255);
    
      foreach ($ts as $k=>$string) {
        // Length of the string
        $len = strlen($string);
        // Y-coordinate of character, X changes, Y is static
        $ypos = 0;
        // Loop through the string
        for($i=0;$i<$len;$i++){
          // Position of the character horizontally
          $xpos = $i * $em;
          $ypos = $k * $el;
          // Draw character
          imagechar($img, $font_size, $xpos, $ypos, $string, $color);
          // Remove character from string
          $string = substr($string, 1);     
        }
      }
      // Return the image
      header("Content-Type: image/png");
      imagepng($img);
      // Remove image
      imagedestroy($img);
    }
    ?>
  • 29-08-2010, 14:07:20
    #6
    imageloadfont('fontyolu');
  • 29-08-2010, 14:19:12
    #7
    bayGaReZ adlı üyeden alıntı: mesajı görüntüle
    imageloadfont('fontyolu');
    <?php
    function sendimagetext($text) {
      // Set font size
      $font_size = 4;
    
      $ts=explode("\n",$text);
      $width=0;
      foreach ($ts as $k=>$string) { //compute width
        $width=max($width,strlen($string));
      }
        $b="fontlar/VOX.TTF";
    $font_size=imageloadfont("$b");
      // Create image width dependant on width of the string
      $width  = imagefontwidth($font_size)*$width;
      // Set height to that of the font
      $height = imagefontheight($font_size)*count($ts);
      $el=imagefontheight($font_size);
      $em=imagefontwidth($font_size);
      // Create the image pallette
      $img = imagecreatetruecolor($width,$height);
      // Dark red background
      $bg = imagecolorallocate($img, 255, 255, 255);
      imagefilledrectangle($img, 0, 0,$width ,$height , $bg);
      // White font color
      $color =  imagecolorallocate($img, 0x33, 0x33, 0x33);
    
      foreach ($ts as $k=>$string) {
        // Length of the string
        $len = strlen($string);
        // Y-coordinate of character, X changes, Y is static
        $ypos = 0;
        // Loop through the string
        for($i=0;$i<$len;$i++){
          // Position of the character horizontally
          $xpos = $i * $em;
          $ypos = $k * $el;
          // Draw character
          
            $font="fontlar/VOX.TTF";
    
        imagechar($img, $font_size, $xpos, $ypos, $string, $color);
          // Remove character from string
          $string = substr($string, 1);     
        }
      }
      // Return the image
    
      
    
    //
      header("Content-Type: image/png");
      imagepng($img);
      // Remove image
      imagedestroy($img);
    
    }
    $mert="Büyük Harfler:\nA";
    sendimagetext($mert);
    ?>
    bu şekilde yaptım ancak hata verdi
  • 29-08-2010, 14:26:23
    #8
    ./fontlar/VOX.TFF şeklinde denediniz mi? ne hatası verdi
  • 29-08-2010, 14:29:50
    #9
    Alıntı
    Warning: imageloadfont() [function.imageloadfont]: gd warning: product of memory allocation multiplication would exceed INT_MAX, failing operation gracefully in C:\xampp\htdocs\fonts\b.php on line 12

    Warning: imageloadfont() [function.imageloadfont]: Error reading font, invalid font header in C:\xampp\htdocs\fonts\b.php on line 12
    böyle bir şey verdi