problem with gd

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • problem with gd

    Hi,
    i got a problem with the gd library at my isp's server.

    I've got the following script, to put a string on a image:

    <?PHP
    header ("Content-type: image/png");

    $gd_text = $_GET['stadt'];
    $font = "/home/stadt-internetde/public_html/bilder/ariblk.ttf";
    //"ariblk.ttf"; ;

    $x = imagettfbbox (23, 0, $font, $_GET['stadt']);

    if((154 + ($x['2']-$x['0'])+12) < 281) $breite = 281; else $breite = 154 +
    ($x['2']-$x['0']+12);

    $im = ImageCreate($breite ,173);
    $im2 = ImageCreateFromJPEG("logo.jpg");

    $orange = ImageColorAllocate ($im, 220, 167, 23);
    $blau = ImageColorAllocate ($im, 51, 102, 153);
    $bgc = ImageColorAllocate ($im, 255, 255, 255);
    ImageFilledRectangle ($im, 0, 0, ImageSX($im), ImageSY($im), $bgc);

    ImageCopyResized($im, $im2, 0, 0, 0, 0, 281, 173, ImageSX($im2),
    ImageSY($im2));


    //border -----
    $test = ImageTTFText ($im, 23, 0, 154, 58, $blau, $font, $gd_text);
    $test = ImageTTFText ($im, 23, 0, 154, 56, $blau, $font, $gd_text);
    $test = ImageTTFText ($im, 23, 0, 156, 56, $blau, $font, $gd_text);
    $test = ImageTTFText ($im, 23, 0, 156, 58, $blau, $font, $gd_text);
    //text --------
    $test = ImageTTFText ($im, 23, 0, 155, 57, $orange, $font, $gd_text);

    ImageColorTransparent($im , $bgc);
    ImagePNG ($im);
    ImageDestroy($im);
    ?>

    On my localhost, everything works fine, but on the internetserver, the
    created image is very ugly!
    On the internet-server i got gd-version 2.0 or higher, so i tried to change
    $im = ImageCreate($breite ,173);
    to
    $im = ImageCreateTrueColor($breite ,173);

    but when I use ImageCreateTrueColor the transparency is gone and the image
    is still ugly!

    Phpinfo shows:
    gd support enabled
    gd version 2.0 or higher
    Freetype support enabled
    Freetype linkage with Freetype
    JPG support enabled
    PNG support enabled
    wbmp support enabled

    Anyone got an idea for me?

    mfg.
    Harry Wiens

  • #2
    take a look at the manual:
    http://de2.php.net/manual/en/functio...ransparent.php

    perhaps the first user contributed note might solve your problem (if it doesn't perhaps some of the other will give an idea. You are not alone with that problem )
    calar at gamigo dot de
    02-Aug-2003 12:53

    ok some works...

    i had a test-sytem with GDLib, phpinfo shows me this version:
    "GD Version 2.0 or higher" so far no porblems with: imageColorTransparent

    Then we had to copy ouer codes to another sever on this server phpinfo shots me version:
    "GD Version bundled (2.0.12 compatible)"

    The jpg was wrong and nothing was transparent.
    The point is, you have to use: imagecopymerge

    Don't if its true on any system just work on
    SUSE 8.2
    PHP 4.3.2
    and another one
    cladiniz at zipmail dot com dot br
    18-Mar-2003 12:19

    If you have a transparent PNG , in PHP 4.3.1 , GD 2.0 , you don't need to set the transparency anymore , it's automatic ...
    greetings

    Kommentar

    Lädt...
    X