$lastday) ) $day_position = ($day_position + 22); // first find the right col to put the daynr. else // now we are at the right column to put in the daynr. { $day_color = $grey; if ($day_position<10) $day_color = $tan; if (strlen($cur)<2) {$sing_add = 4;} $fin_position = ($day_position + $sing_add); if (($cur==$today)&&($month==$curmonth)&&($year==$curyear)) { $day_color = $yellow; ImageTTFText($im, 13, 0, $fin_position, $ver_position+1, $day_color, "../fonts/arialbd.ttf", "$cur"); } else ImageTTFText($im, 12, 0, $fin_position, $ver_position, $day_color, "../fonts/arialbd.ttf", "$cur"); $day_position = ($day_position + 22); $last_row_used = 1; }// else } // for // now we can put the weeknumber here: $wn=$weeknr+$k; if (strlen($wn)<2) {$sing_add = 4;} else $sing_add=0; ImageTTFText($im, 10, 0, 159+$sing_add, $ver_position, $day_color, "../fonts/arialbd.ttf", "$wn"); $day_position = 5; if ($last_row_used) $ver_position = ($ver_position + 17); } // for # month and year (centered in Arial Bold) $spc = 23; $st_add = 0; $st = "$mon_yr"; $st_len = strlen($st); $st_margin = (14 - $st_len); if ($st_margin > 0) {$st_add = ($st_margin * 4);} $spc = ($spc + $st_add); ImageTTFText($im, 14, 0, $spc, 15, $white, "../fonts/arialbd.ttf", "$st"); # weekday names ImageString($im, 2, 3, 23, "Sun", $orange); ImageString($im, 2, 25, 23, "Mon", $orange); ImageString($im, 2, 47, 23, "Tue", $orange); ImageString($im, 2, 69, 23, "Wed", $orange); ImageString($im, 2, 91, 23, "Thu", $orange); ImageString($im, 2, 113, 23, "Fri", $orange); ImageString($im, 2, 135, 23, "Sat", $orange); //ImageString($im, 2, 157, 23, "week", $orange); if ($ver_position<140) # crop the calendar if it doesn\'t go into last row { $im_out = ImageCreate(178, 125); $out_black = ImageColorAllocate($im_out, 50, 50, 50); ImageRectangle($im, 1, 124, 177, 124, $dkgrey); ImageCopyResized($im_out, $im, 0, 0, 0, 0, 178, 125, 178, 125); ImageColorTransparent($im_out, $out_black); ImageGIF($im_out, "../dategif/$datecode$gif"); ImageGIF($im_out); ImageDestroy($im); ImageDestroy($im_out); } else { ImageColorTransparent($im, $black); ImageGif($im, "../dategif/$datecode$gif"); ImageGif($im); ImageDestroy($im); } ?>