Here My example is to use the image function in PHP to create a dynamic GIF image files, users at different times access can return different small calendar pictures, the code is as follows:
<?php
Header ("Content-type:image/gif");
$y =date (y);
$m =date (n);
$w =date (w);
$d =date (j); $ws [0]= "Sun";
$ws [1]= "Mon";
$ws [2]= "Tue";
$ws [3]= "Wed";
$ws [4]= "Thu";
$ws [5]= "Fri";
$ws [6]= "Sat";
$image = imagecreate (80,100); if ($w ==0 | | $w ==6) {
$colorW = imagecolorallocate ($image, 0, 0);
}
else{
$colorW = imagecolorallocate ($image, 0, 0, 255);
} $COLORBK = Imagecolorallocate ($image, 0,0,120);
$colorGreen = imagecolorallocate ($image, 0, 225, 0);
$colorB = imagecolorallocate ($image, 255,255,255);
$colorBlack = imagecolorallocate ($image, 0,0,0); Imagefill ($image, 0, 0, $COLORBK); Imagefilledrectangle ($image, 10,10,70,90, $colorB); Imagestring ($image, 5, MB, $y, $colorBlack);
Imagestring ($image, 5, $m, $colorGreen);
Imagestring ($image, 5, $d, $colorW);
Imagestring ($image, 4, $ws [$w], $colorW);
Imagegif ($image);? "
Description: Your PHP must have a support GIF image of the GD library, if you do not support the current PHP, please go to download the previous GD library; In addition, with a question, please the heroes advice: how can I enlarge the font?