Create Transparent Colors in PHP

Description

The following code shows how to create Transparent Colors.

Example


<?php/*from  w w  w . j  a  v  a  2s.c  o m*/
header("Content-type: image/gif");

$image = imagecreate( 200, 200 );
$red = imagecolorallocate($image, 255,0,0);
$blue = imagecolorallocate($image, 0,0,255 );
$points = array (10, 10,
                 190, 190,
                 190, 10,
                 10, 190
);

imagefilledpolygon( $image, $points, count( $points )/2 , $blue );
imagecolortransparent( $image, $red );
imagegif($image);
?>

The code above generates the following result.

Create Transparent Colors in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text