| 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 : /home2/cp648411/public_html/kainumber.com/wallpaper/ |
Upload File : |
<?php
include('../include/class.php');
$list = array('table'=>'wallpapers','where'=>'id = "'.$_POST['name_id'].'" AND status = "1"');
$view = $view_db->view($list);
$row1 = $view_db->q($view);
// (A) OPEN IMAGE
$img = imagecreatefromjpeg("../redbag/wallpaper/".$row1['image']);
// (B) TEXT & FONT SETTINGS
$fontFile = "C:/xampp7/htdocs/kainnumber/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($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);
}
}
//echo $row1['type'];
//exit();
// (E) OUTPUT IMAGE
$namefile='test';
header("Content-type: image/jpeg");
header('Content-disposition: attachment; filename='.$namefile.'.jpg');
readfile(imagejpeg($img));
imagejpeg($img);
imagedestroy($img);
?>