| Server IP : 104.21.37.246 / Your IP : 172.71.28.146 [ 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/simded.com/wallpaper/home/ |
Upload File : |
<?php
include('../include/class.php');
date_default_timezone_set("Asia/Bangkok");
putenv('GDFONTPATH=' . realpath('.'));
$date = date("YmdHis");
$datetime = date("Y-m-d H:i:s");
//$list = array('table'=>'wallpapers','where'=>'id = "'.@$_POST['name_id'].'" AND status = "1"');
$list = array('table'=>'wallpapers','where'=>'id = "'.@$_GET['id'].'" AND status = "1"');
$view = $view_db->view($list);
$row1 = $view_db->q($view);
if($row1['image_free']==''){
$bg = "../../redbag/wallpaper/".$row1['image'];
}else{
$bg = "../../redbag/wallpaper/".$row1['image_free'];
}
$src= "../../redbag/wallpaper/".$row1['image'];
//echo $bg;
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;
}
$img = image_type($bg);
$text_detail = explode(',',$row1['detail_text']);
$color_r = $row1['font_color'];
if(strlen($row1['font_color'])==0){
$color_r = '255,255,255';
}
/*
echo "<pre>";
print_r($img);
echo "</pre>";
*/
$color = explode(',',$color_r);
$fontColor = imagecolorallocate($img, $color[0], $color[1], $color[2]);
$fontFile = realpath('../../fonts/'.$text_detail[3]); // CHANGE TO YOUR OWN!
$fontSize = $text_detail[4];
$angle = 0;
$iWidth = imagesx($img);
$iHeight = imagesy($img);
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;
}
if($row1['position']==''){
$positionX = CEIL(($iWidth - $tWidth) / 1);
$positionX = $positionX<0 ? 0 : $positionX;
}
$bottomY = ($row1['position2']=='')?10:$row1['position2'];
//echo $src;
//exit();
$name_table4='wal_log_order';
$id_order=@$_GET['id'];
$type=3;
$status='success';
$sql = array('table'=>$name_table4,'count'=>'MAX(id) AS max_id');
$view_sql = $view_db->view($sql);
$row = $view_db->q($view_sql);
$max_id = $row['max_id'];
if($max_id==''){
$max_id=1;
}else{
$max_id=$max_id+1;
}
$list = array(
'table'=>$name_table4,
'id'=>"'".$max_id."'",
'id_order'=>"'".$id_order."'",
'type'=>"'".$type."'",
'datetime'=>"'".@$datetime."'",
'status'=>"'".$status."'"
);
$add = $actiondata_db->add_db($list);
$jpeg_bg = image_type($bg);
list($newwidth, $newheight) = getimagesize($bg);
$img = imagecreatetruecolor($newwidth, $newheight);
imagecopyresampled($img, $jpeg_bg, 0, 0, 0, 0, $newwidth, $newheight, $newwidth, $newheight);
/*
$png_bg = image_type('../../redbag/wallpaper/'.$row1['image']);
list($width, $height) = getimagesize('../../redbag/wallpaper/'.$row1['image']);
imagecopyresampled($img, $png_bg, $positionX, $bottomY, 0, 0, $width, $height, $width, $height); //l,t,r,b
*/
$txt_random='';
imagettftext($img, $fontSize, $angle, $positionX, $bottomY, $fontColor, $fontFile, $txt_random);
// (E) OUTPUT IMAGE
// (E) OUTPUT IMAGE
$namefile='wallmoo-'.$date;
header("Content-type: image/jpeg");
header("Cache-Control: no-store, no-cache");
header('Content-disposition: attachment; filename='.$namefile.'.jpg');
//readfile(imagejpeg($img));
readfile($img);
imagejpeg($img);
imagedestroy($img);
?>