| Server IP : 172.67.216.113 / Your IP : 104.23.243.32 [ 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 : /home/cp648411/www/kainumber.com/wallpaper/home/ |
Upload File : |
<?php
include('../include/class.php');
include('../include/check.php');
date_default_timezone_set("Asia/Bangkok");
$date = date("YmdHis");
$list = array('table'=>'wallpapers','where'=>'id = "'.$_POST['name_id'].'" AND status = "1"');
$view = $view_db->view($list);
$row1 = $view_db->q($view);
// /print_r($_POST);
$src= "../../redbag/wallpaper/".$row1['image_free'];
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'];
$jpeg = image_type("../../redbag/wallpaper/".$row1['image_free']);
list($newwidth, $newheight) = getimagesize("../../redbag/wallpaper/".$row1['image_free']);
//echo $_POST['zodiac'];
if($_POST['zodiac']){
$list2 = array('table'=>'wal_zodiac','where'=>'id = "'.$_POST['zodiac'].'"');
$view2 = $view_db->view($list2);
$row2 = $view_db->q($view2);
$png = image_type('../../redbag/wal_zodiac/'.$row2['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($_POST['element']){
$list3 = array('table'=>'wal_element','where'=>'id = "'.$_POST['element'].'"');
$view3 = $view_db->view($list3);
$row3 = $view_db->q($view3);
$png2 = image_type('../../redbag/wal_element/'.$row3['image']);
$jpeg2 = image_type("../../redbag/wallpaper/".$row1['image_free']);
list($width2, $height2) = getimagesize('../../redbag/wal_element/'.$row3['image']);
$img = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($img, $jpeg2, 0, 0, 0, 0, $newwidth, $newheight, $newwidth, $newheight);
}
if($row1['type'] == 1 ){
if(@$_POST['namefull']){
$txt = $_POST['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(@$_POST['detail']){
$txt2 = $_POST['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(@$_POST['phonenumber']){
$txt3 = $_POST['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(@$_POST['zodiac']){
//imagecopyresampled($img, $png, $row1['positionz_1'], $row1['positionz_2'], 0, 0, $width, $height, $width, $height); //l,t,r,b
}
if(@$_POST['element']){
//imagecopyresampled($img, $png2, $row1['positione_1'], $row1['positione_2'], 0, 0, $width2, $height2, $width2, $height2); //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);
?>