| Server IP : 104.21.37.246 / Your IP : 104.23.243.33 [ 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/wallpaper/profile/ |
Upload File : |
<?php
include('../include/class.php');
date_default_timezone_set("Asia/Bangkok");
$date = date("YmdHis");
$list = array('table'=>'wal_order','where'=>'id = "'.$_GET['id'].'"');
$view = $view_db->view($list);
$row = $view_db->q($view);
$list = array('table'=>'wallpapers','where'=>'id = "'.$row['image'].'" AND status = "1"');
$view = $view_db->view($list);
$row1 = $view_db->q($view);
// (A) OPEN IMAGE
//$img = imagecreatefromjpeg("../../redbag/wallpaper/".$row1['image']);
$src= "../../redbag/wallpaper/".$row1['image'];
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;
}
//echo image_type($src);
//$img = imagecreatefromjpeg("../../redbag/wallpaper/".$row1['image']);
$img = image_type($src);
$fontFile = realpath('../../fonts/'.$row1['font_family']); // CHANGE TO YOUR OWN!
$fontSize = $row1['font_site'];
$color = explode(',',$row1['font_color']);
$fontColor = imagecolorallocate($img, $color[0], $color[1], $color[2]);
$angle = 0;
$iWidth = imagesx($img);
$iHeight = imagesy($img);
$bottomY = $row1['position2'];
if($row['zodiac_id']<>0){
$list2 = array('table'=>'wal_zodiac','where'=>'id = "'.$row['zodiac_id'].'"');
$view2 = $view_db->view($list2);
$row2 = $view_db->q($view2);
$png = image_type('../../redbag/wal_zodiac/'.$row2['image']);
$jpeg = image_type("../../redbag/wallpaper/".$row1['image']);
list($newwidth, $newheight) = getimagesize("../../redbag/wallpaper/".$row1['image']);
list($width, $height) = getimagesize('../../redbag/wal_zodiac/'.$row2['image']);
$img = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($img, $jpeg, 0, 0, 0, 0, $newwidth, $newheight, $newwidth, $newheight);
}
if($row['namefull'] !='' ){
if(@$row['namefull']){
$txt = $row['namefull'];
$txt = mb_convert_encoding($txt, 'HTML-ENTITIES', 'UTF-8');
$txt = preg_replace('~^(&([a-zA-Z0-9]);)~', htmlentities('${1}'), $txt);
$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]]);
if($row1['position']=='left'){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
$positionX = 0;
}
if($row1['position']=='center'){
$positionX = CEIL(($iWidth - $tWidth) / 2);
$positionX = $positionX<0 ? 0 : $positionX;
}
if($row1['position']=='right'){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
}
imagettftext($img, $fontSize, $angle, $positionX, $bottomY, $fontColor, $fontFile, $txt);
}
if(@$row['detail'] !=''){
$txt2 = $row['detail'];
$txt2 = mb_convert_encoding($txt2, 'HTML-ENTITIES', 'UTF-8');
$txt2 = preg_replace('~^(&([a-zA-Z0-9]);)~', htmlentities('${1}'), $txt2);
$tSize = imagettfbbox($fontSize, $angle, $fontFile, $txt2);
$tWidth = max([$tSize[2], $tSize[4]]) - min([$tSize[0], $tSize[6]]);
$tHeight = max([$tSize[5], $tSize[7]]) - min([$tSize[1], $tSize[3]]);
if($row1['position']=='left'){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
$positionX = 0;
}
if($row1['position']=='center'){
$positionX = CEIL(($iWidth - $tWidth) / 2);
$positionX = $positionX<0 ? 0 : $positionX;
}
if($row1['position']=='right'){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
}
$bottomY = $bottomY +150;
imagettftext($img, $fontSize, $angle, $positionX, $bottomY, $fontColor, $fontFile, $txt2);
}
if(@$row['phonenumber']){
$txt3 = $row['phonenumber'];
$txt3 = mb_convert_encoding($txt3, 'HTML-ENTITIES', 'UTF-8');
$txt3 = preg_replace('~^(&([a-zA-Z0-9]);)~', htmlentities('${1}'), $txt3);
$tSize = imagettfbbox($fontSize, $angle, $fontFile, $txt3);
$tWidth = max([$tSize[2], $tSize[4]]) - min([$tSize[0], $tSize[6]]);
$tHeight = max([$tSize[5], $tSize[7]]) - min([$tSize[1], $tSize[3]]);
if($row1['position']=='left'){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
$positionX = 0;
}
if($row1['position']=='center'){
$positionX = CEIL(($iWidth - $tWidth) / 2);
$positionX = $positionX<0 ? 0 : $positionX;
}
if($row1['position']=='right'){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
}
$bottomY = $bottomY +150;
imagettftext($img, $fontSize, $angle, $positionX, $bottomY, $fontColor, $fontFile, $txt3);
}
}
if($row['zodiac_id']<>0){
imagecopyresampled($img, $png, $row1['positionz_1'], $row1['positionz_2'], 0, 0, $width, $height, $width, $height); //l,t,r,b
}
//echo $row1['type'];
//exit();
// (E) OUTPUT IMAGE
$namefile='wallmoo-'.$date;
header("Content-type: image/jpeg");
header('Content-disposition: attachment; filename='.$namefile.'.jpg');
readfile(imagejpeg($img));
imagejpeg($img);
imagedestroy($img);
?>