PHP/Graphics Image/imagepng

Материал из Web эксперт
Перейти к: навигация, поиск

Include color information

 
<?php
    $image = imagecreate(400,300);
    $gold = imagecolorallocate($image, 255, 240, 00);
    imagepng($image);
    imagedestroy($image);
?>



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);
?>