| Server IP : 104.21.37.246 / Your IP : 172.71.28.145 [ Web Server : Apache System : Linux cpanel01wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.59.el6.x86_64 #1 SMP Thu Dec 6 05:11:00 EST 2018 x86_64 User : cp648411 ( 1354) PHP Version : 7.2.34 Disable Function : NONE Domains : 0 Domains MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home2/cp648411/public_html/kainumber.com/auspiciousday/ |
Upload File : |
<?php
session_start();
function imm(){
date_default_timezone_set("Asia/Bangkok");
putenv('GDFONTPATH=' . realpath('.'));
$date = date("YmdHis");
$date_r = date("Hi");
$date_d = date("N");
$month_short_th = array("ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
if($date_d==0){
$txt2 = 'อาทิตย์ ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="0000";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="X";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="n";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="00";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="0";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="0000";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="X";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="n";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="00";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="0";}
}
if($date_d==1){
$txt2 = 'จันทร์ ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="0";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="0000";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="X";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="n";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="00";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="0";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="0000";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="X";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="n";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="00";}
}
if($date_d==2){
$txt2 = 'อังคาร ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="00";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="0";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="0000";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="X";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="n";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="00";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="0";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="0000";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="X";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="n";}
}
if($date_d==3){
$txt2 = 'พุธ ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="n";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="00";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="0000";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="0000";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="X";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="n";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="00";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="0";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="0000";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="X";}
}
if($date_d==4){
$txt2 = 'พฤหัสบดี ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="X";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="n";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="00";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="0";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="0000";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="X";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="n";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="00";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="0";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="0000";}
}
if($date_d==5){
$txt2 = 'ศุกร์ ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="0000";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="X";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="n";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="00";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="0";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="0000";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="X";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="n";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="00";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="0";}
}
if($date_d==6){
$txt2 = 'เสาร์ ที่ '.date("d").' '.$month_short_th[date("n")];
if($date_r >= 601 && $date_r <= 824 ){$txt="06:01 - 08:24";$sym ="0";}
if($date_r >= 825 && $date_r <= 1041){$txt="08:25 - 10:41";$sym ="0000";}
if($date_r >= 1042 && $date_r <= 1312){$txt="10:42 - 13:12";$sym ="X";}
if($date_r >= 1313 && $date_r <= 1536){$txt="13:13 - 15:36";$sym ="n";}
if($date_r >= 1537 && $date_r <= 1800){$txt="15:37 - 18:00";$sym ="00";}
if($date_r >= 1801 && $date_r <= 2024){$txt="18:01 - 20:24";$sym ="0";}
if($date_r >= 2025 && $date_r <= 2248){$txt="20:25 - 22:48";$sym ="0000";}
if($date_r >= 2249 && $date_r <= 0112){$txt="22:49 - 01:12";$sym ="X";}
if($date_r >= 113 && $date_r <= 336){$txt="01:13 - 03:36";$sym ="n";}
if($date_r >= 337 && $date_r <= 600){$txt="03:07 - 06:00";$sym ="00";}
}
if($sym==="0"){$image_link = "share/share_orange.jpg";}
if($sym==="00"){$image_link = "share/share_blue.jpg";}
if($sym==="0000"){$image_link = "share/share_green.jpg";}
if($sym==="X"){$image_link = "share/share_red.jpg";}
if($sym==="n"){$image_link = "share/share_yellow.jpg";}
//Direct link to image
$split_image = pathinfo($image_link);
$img = image_type($image_link);
$fontFile = realpath('../fonts/DS-DIGIT.TTF'); // CHANGE TO YOUR OWN!
$fontFile2 = realpath('../fonts/LOUNGETH-BOLD.OTF'); // CHANGE TO YOUR OWN!
$fontSize = 55;
$fontSize2 = 25;
$color = explode(',','255,255,255');
$fontColor = imagecolorallocate($img, $color[0], $color[1], $color[2]);
$angle = 0;
//$txt="06:01 - 08:24";
//$txt2="อังคาร ที่ 14 มี.ค.";
$txt2 = mb_convert_encoding($txt2, 'HTML-ENTITIES', 'UTF-8');
$txt2 = preg_replace('~^(&([a-zA-Z0-9]);)~', htmlentities('${1}'), $txt2);
$iWidth = imagesx($img);
$iHeight = imagesy($img);
$iWidth2 = imagesx($img);
$iHeight2 = imagesy($img);
$tSize = imagettfbbox($fontSize, $angle, $fontFile, $txt);
$tWidth = max([$tSize[2], $tSize[4]]) - min([$tSize[0], $tSize[6]]);
$tHeight = max([$tSize[5], $tSize[7]]) - min([$tSize[1], $tSize[3]]);
$tSize2 = imagettfbbox($fontSize2, $angle, $fontFile, $txt2);
$tWidth2 = max([$tSize2[2], $tSize2[4]]) - min([$tSize2[0], $tSize2[6]]);
$tHeight2 = max([$tSize2[5], $tSize2[7]]) - min([$tSize2[1], $tSize2[3]]);
$positionX = CEIL(($iWidth - $tWidth) / 2);
$positionX = $positionX<0 ? 0 : $positionX;
$positionX2 = CEIL(($iWidth2 - $tWidth2) / 2) + 45;
$positionX2 = $positionX2<0 ? 0 : $positionX2;
//echo $positionX2;
$positionY=103;
$positionY2=156;
//exit();
imagettftext($img, $fontSize, $angle, $positionX, $positionY, $fontColor, $fontFile, $txt);
imagettftext($img, $fontSize2, $angle, $positionX2, $positionY2, $fontColor, $fontFile2, $txt2);
$namefile='auspiciousday-'.$date.".jpg";
//header("Content-type: image/jpeg");
imagejpeg($img,"share/".$namefile,100);
//readfile(imagejpeg($img,"images-folder/".$namefile.".jpg",100));
imagedestroy($img);
return $namefile;
}
//echo $namefile;
function image_type($src){
if(!list($w, $h) = getimagesize($src)) return "Unsupported picture type!";
$type = strtolower(substr(strrchr($src,"."),1));
if($type == 'jpeg') $type = 'jpg';
switch($type){
case 'bmp': $img = imagecreatefromwbmp($src); break;
case 'gif': $img = imagecreatefromgif($src); break;
case 'jpg': $img = imagecreatefromjpeg($src); break;
case 'png': $img = imagecreatefrompng($src); break;
default : return "Unsupported picture type!";
}
return $img;
}
?>