PHPGD

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • BryanA

    PHPGD

    I am trying to overlay text in a ttf font over an already existing
    image. From what I can see it should work but I'm not sure what the
    problem is.

    <?
    Header ("Content-type: image/png");
    putenv('GDFONTP ATH=' . realpath('.'));
    $font = 'j';

    $img_handle = imageCreateFrom PNG("stupid.png ");
    $color = ImageColorAlloc ate ($img_handle, 100, 100, 100);
    $wrong = $_GET['wrong'];
    $right = $_GET['right'];

    imagettftext($i mg_handle, 3, 10, 49, $font, $color, "$wrong is
    $right!!");
    ImagePng ($img_handle);


    ImageDestroy ($img_handle);
    ?>

    It says the image can not be displayed because it contains errors.

    Thanks,
    Ryan
  • C. (http://symcbean.blogspot.com/)

    #2
    Re: PHPGD

    On 1 Oct, 01:13, BryanA <syv.r...@gmail .comwrote:
    I am trying to overlay text in a ttf font over an already existing
    image. From what I can see it should work but I'm not sure what the
    problem is.
    >
    <?
    Header ("Content-type: image/png");
    putenv('GDFONTP ATH=' . realpath('.'));
    $font = 'j';
    >
    $img_handle = imageCreateFrom PNG("stupid.png ");
    $color = ImageColorAlloc ate ($img_handle, 100, 100, 100);
    $wrong = $_GET['wrong'];
    $right = $_GET['right'];
    >
    imagettftext($i mg_handle, 3, 10, 49, $font, $color, "$wrong is
    $right!!");
    ImagePng ($img_handle);
    >
    ImageDestroy ($img_handle);
    ?>
    >
    It says the image can not be displayed because it contains errors.
    Try losing the content type header and see what you get.

    Or read your logs.

    C.

    Comment

    Working...