<?php
The first step is to set the file MIME type and change the output type to the image stream. Default is HTML if not set.
Header ("Content-type:image/png");
The second step creates a blank graphics area
$im = Imagecreatetruecolor (200,200);
The third step fills the background color for the area, and the first call to Imagecolorallocate () fills the color palette-based image with the background color
$blue = Imagecolorallocate ($im, 0,102,255);
Imagefill ($im, 0,0, $blue);
The fourth step is drawn on the background
$white = Imagecolorallocate ($im, 255,255,255);
Imageline ($im, 0,0,200,200, $white);
Imagestring ($im, 5,50,50, ' Hello world! ', $white);
Fifth Step output graphics
Imagepng ($im);
After the sixth step output image, destroy the image, release the memory
Imagedestroy ($im);
The seventh step calls the image on the other page
In the HTML page call:
Page display:
PHP-Image processing