<?php
header("Content-type: image/png");
$imgWidth=700;
$imgHeight=515;
$imgWidth2=$imgWidth - 1;
$imgHeight2=$imgHeight - 1;
$zero = 0;
$month = date("F");
$numofdays = date("t");
// Create image and define colors
$image=imagecreate($imgWidth, $imgHeight);
$colorWhite=imagecolorallocate($image, 255, 255, 255);
$colorGrey=imagecolorallocate($image, 192, 192, 192);
$colorBlue=imagecolorallocate($image, 0, 0, 255);
$colorBlack=imagecolorallocate($image, 0, 0, 0);
// Create border around image
imageline($image, $zero, $zero, $zero, $imgHeight, $colorBlack);
imageline($image, $zero, $zero, $imgWidth, $zero, $colorBlack);
imageline($image, $zero, 15, $imgWidth, 15, $colorBlack);
imageline($image, $zero, 30, $imgWidth, 30, $colorBlack);
imageline($image, $zero, 130, $imgWidth, 130, $colorBlack);
imageline($image, $zero, 230, $imgWidth, 230, $colorBlack);
imageline($image, $zero, 330, $imgWidth, 330, $colorBlack);
imageline($image, $zero, 430, $imgWidth, 430, $colorBlack);
imageline($image, $imgWidth2, $zero, $imgWidth2, $imgHeight2, $colorBlack);
imageline($image, $zero, $imgHeight2, $imgWidth2, $imgHeight2, $colorBlack);
//days of week
imagestring($image, 3, 2, 16, " Sunday", $colorBlue); // Sunday
imagestring($image, 3, 102, 16, " Monday", $colorBlue); // Monday
imagestring($image, 3, 202, 16, " Tuesday", $colorBlue); // Tuesday
imagestring($image, 3, 302, 16, " Wednesday", $colorBlue); // Wednesday
imagestring($image, 3, 402, 16, " Thursday", $colorBlue); // Thursday
imagestring($image, 3, 502, 16, " Friday", $colorBlue); // Friday
imagestring($image, 3, 602, 16, " Saturday", $colorBlue); // Saturday
// Create grid
for ($i=1; $i<8; $i++){
imageline($image, $i*100, 16, $i*100, $imgHeight, $colorBlack);
//imageline($image, 0, $i*100, $imgWidth, $i*100, $colorBlack);
}
imagestring($image, 3, 316, 1, $month, $colorBlue); // 1
imagestring($image, 3, 2, 31, "1", $colorBlue); // 1
imagestring($image, 3, 102, 31, "2", $colorBlue); // 2
imagestring($image, 3, 202, 31, "3", $colorBlue); // 3
imagestring($image, 3, 302, 31, "4", $colorBlue); // 4
imagestring($image, 3, 402, 31, "5", $colorBlue); // 5
imagestring($image, 3, 502, 31, "6", $colorBlue); // 6
imagestring($image, 3, 602, 31, "7", $colorBlue); // 7
imagestring($image, 3, 2, 131, "8", $colorBlue); // 8
imagestring($image, 3, 102, 131, "9", $colorBlue); // 9
imagestring($image, 3, 202, 131, "10", $colorBlue); // 10
imagestring($image, 3, 302, 131, "11", $colorBlue); // 11
imagestring($image, 3, 402, 131, "12", $colorBlue); // 12
imagestring($image, 3, 502, 131, "13", $colorBlue); // 13
imagestring($image, 3, 602, 131, "14", $colorBlue); // 14
imagestring($image, 3, 2, 231, "15", $colorBlue); // 15
imagestring($image, 3, 102, 231, "16", $colorBlue); // 16
imagestring($image, 3, 202, 231, "17", $colorBlue); // 17
imagestring($image, 3, 302, 231, "18", $colorBlue); // 18
imagestring($image, 3, 402, 231, "19", $colorBlue); // 19
imagestring($image, 3, 502, 231, "20", $colorBlue); // 20
imagestring($image, 3, 602, 231, "21", $colorBlue); // 21
imagestring($image, 3, 2, 331, "22", $colorBlue); // 22
imagestring($image, 3, 102, 331, "23", $colorBlue); // 23
imagestring($image, 3, 202, 331, "24", $colorBlue); // 24
imagestring($image, 3, 302, 331, "25", $colorBlue); // 25
imagestring($image, 3, 402, 331, "26", $colorBlue); // 26
imagestring($image, 3, 502, 331, "27", $colorBlue); // 27
imagestring($image, 3, 602, 331, "28", $colorBlue); // 28
imagestring($image, 3, 2, 431, "29", $colorBlue); // 29
imagestring($image, 3, 102, 431, "30", $colorBlue); // 30
imagestring($image, 3, 202, 431, "31", $colorBlue); // 31
imagestring($image, 3, 302, 431, "32", $colorBlue); // 32
imagestring($image, 3, 402, 431, "33", $colorBlue); // 33
imagestring($image, 3, 502, 431, "34", $colorBlue); // 34
imagestring($image, 3, 602, 431, "35", $colorBlue); // 35
imagepng($image, "test.jpg");
imagedestroy($image);
?>
I am trying to make a calendar, but this is what I have so far to create the month, and each cell.
How would I determine where to start numbering the month?
Any help would be appreciated.
Thanks