告诉我需要什么函数、先后顺序就好了

解决方案 »

  1.   

    手册上的例子
    header("Content-type: image/png");
    $string = $_GET['text'];
    $im     = imagecreatefrompng("images/button1.png");
    $orange = imagecolorallocate($im, 220, 210, 60);
    $px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
    imagestring($im, 3, $px, 9, $string, $orange);
    imagepng($im);
    imagedestroy($im);
      

  2.   

    PNG
    <?php
    $im = imagecreatefrompng("test.png");header('Content-type: image/png');imagepng($im);
    imagedestroy($im);
    ?>
    GIF
    <?php
    // Create a new image instance
    $im = imagecreatetruecolor(100, 100);// Make the background white
    imagefilledrectangle($im, 0, 0, 99, 99, 0xFFFFFF);// Draw a text string on the image
    imagestring($im, 3, 40, 20, 'GD Library', 0xFFBA00);// Output the image to browser
    header('Content-type: image/gif');imagegif($im);
    imagedestroy($im);
    ?>