This commit is contained in:
Tony Yang
2019-11-22 12:14:00 +08:00
commit ec5c74c29f
10 changed files with 149 additions and 0 deletions

2
web/.htaccess Normal file
View File

@@ -0,0 +1,2 @@
RewriteEngine On
RewriteRule ^(.+)\.png$ $1.php [L]

36
web/exam.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
require('../vendor/autoload.php');
header("Cache-Control: max-age=1");
header("Content-type: image/png");
$N=strtotime("now");
$dir=strtotime("2020-01-17 01:15:00");
$ds=$dir-$N;
$D=intval($ds/86400);
$H=intval(($ds%86400)/3600);
$M=intval(($ds%3600)/60);
$S=$ds%60;
$str=
str_pad($D,2,'0',STR_PAD_LEFT)."".
str_pad($H,2,'0',STR_PAD_LEFT)."".
str_pad($M,2,'0',STR_PAD_LEFT)."".
str_pad($S,2,'0',STR_PAD_LEFT)."";
$font = dirname(__FILE__)."/font/Regular.ttf";
$img = imagecreatetruecolor(350, 75);
$white = imagecolorallocate($img, 220, 220, 220);
$blue = imagecolorallocate($img, 51, 150, 255);
$blue2 = imagecolorallocate($img, 0, 0, 136);
$black = imagecolorallocate($img, 0, 0, 0);
imagefill($img, 0, 0, $white);
imagettftext($img, 20, 0, 5, 25, $blue2, $font, "距109學測還剩:");
imagettftext($img, 30, 0, 5, 65, $blue, $font, $str);
//size,,x,y
imagepng($img);
imagedestroy($img);
?>'

BIN
web/font/Regular.ttf Normal file

Binary file not shown.

3
web/index.php Normal file
View File

@@ -0,0 +1,3 @@
<?php
echo "hello world";