Working with PNGs : imagepng « Graphics Image « PHP






Working with PNGs

 
<?php
    $animage = imagecreate (200, 200);
    $red = imagecolorallocate ($animage, 255, 0, 0);
    imagerectangle ($animage, 0, 0, 200, 200, $red);
    $black = imagecolorallocate ($animage, 0, 0, 0);
    imagefilledellipse($animage, 100, 100, 150, 150, $black);
    $white = imagecolorallocate ($animage, 255, 255, 255);
    imagestring($animage, 5, 48, 95, "Hello World!", $white);
    imagepng ($animage);
    header ("Content-type: image/png");
    imagedestroy ($animage);
?>
  
  








Related examples in the same category

1.Include color information