Create jpg image and fill rectangle in PHP

Description

The following code shows how to create jpg image and fill rectangle.

Example


<?php//from ww w  .j a v  a2  s .  c  o m
    $animage = imagecreate (200, 200);
    $red = imagecolorallocate ($animage, 255, 0, 0);
    imagerectangle ($animage, 0, 0, 200, 200, $red);
    imagejpeg ($animage);
    header ("Content-type: image/jpeg");
    imagedestroy ($animage);
?>

The code above generates the following result.

Create jpg image and fill rectangle in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text