Using imagedeallocate() : imagedeallocate « Graphics Image « PHP






Using imagedeallocate()

 
<?php
    define("WIDTH", 200);
    define("HEIGHT", 200);

    $img = imagecreate(WIDTH, HEIGHT);
    $bg = $white = imagecolorallocate($img, 0xFF, 0xFF, 0xFF);
    $black = imagecolorallocate($img, 0, 0, 0);

    imagefilledrectangle($img, 10, 10, WIDTH-11, HEIGHT-11, $black);
    imagecolordeallocate($img, $black);
    $red = imagecolorallocate($img, 0xFF, 0, 0);

    header("Content-Type: image/png");
    imagepng($img);
?>
  
  








Related examples in the same category