Loading:


    imagecreatetruecolor
    resource imagecreatetruecolor ( int $width , int $height )


    Zwraca indentyfiikator obrazu reprezentujący czarny obraz w określonym rozmiarze


     Parametry

     

    width - Szerokość obrazka.

     

    height - Wysokość obrazka.


    Zwracane wartości


    Zwraca zasób indentyfikatora obrazu lub FALSE



    Napisz Artyku³

    Listing


    Przykład #1 Tworzy nowy strumień obrazu GD i wyświetla go
    <?php
    header ('Content-type: image/png');
    $im = @imagecreatetruecolor(120, 20)
          or die('Cannot Initialize new GD image stream');
    $text_color = imagecolorallocate($im, 233, 14, 91);
    imagestring($im, 1, 5, 5,  'A Simple Text String', $text_color);
    imagepng($im);
    imagedestroy($im);
    ?>
     




    Dodano przez: igor
    Ranga: Administrator serwisu Punktów: 0
    Komentarze użytkowników
    I put this together - combining two of the examples and then generated the text dynamically. but, with this set up, i was able to get the transparent background working as well.
    • Zobacz kod dodany do tego wpisu
      • <?php
        // Set the content-type

        header('Content-type: image/png');

        // Create the image
        $im = imagecreatetruecolor(175, 15);
        imagesavealpha($im, true);

        // 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, 150, 25, $black);
        $trans_colour = imagecolorallocatealpha($im, 0, 0, 0, 127);
        imagefill($im, 0, 0, $trans_colour);

        // The text to draw
        $text = $_GET['text'];
        // Replace path by your own font path
        $font = 'catriel regular.ttf';

        // Add some shadow to the text
        imagettftext($im, 9, 0, 13, 16, $black, $font, $text);

        // Add the text
        imagettftext($im, 9, 0, 12, 15, $white, $font, $text);

        // Using imagepng() results in clearer text compared with imagejpeg()
        imagepng($im);
        imagedestroy($im);
        ?>
    autor: igor | 4060 | 2009-10-08 14:39:41


      • Tre¶æ komentarza
        Kod do komentarza (opcjonalnie)
        PHP JavaScript MySQL Smarty SQL HTML CSS ActionScript
        Autor
        Token
        token

         

         








    funkcje.net
    Wszelkie prawa zastrzeżone©. | Funkcje.net 2008-2025 v.1.5 | design: diviXdesign & rainbowcolors