| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/HostingSpaces/admin/penpalamerica.com/wwwroot/penpal/ |
Upload File : |
<?php
include "general.php";
include "connect.php";
include 'sendmailclient.php';
if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') {
header('Access-Control-Allow-Origin : *');
header('Access-Control-Allow-Methods : POST, GET, OPTIONS, PUT, DELETE');
header('Access-Control-Allow-Headers : *');
exit;
}
//$response = array();
date_default_timezone_set('africa/lagos');
//header( "Content-type: image/png" );
//imagepng($img);
$txt =$_POST["text"];
$email =$_POST["email"];
$txtName =$_POST["username"];
$txtDate =$_POST["textdate"];
$text= $textMessage;
$font = "C:\Windows\Fonts\arial.ttf"; // ! CHANGE THIS TO YOUR OWN !
$font_size1 = 10;
$font_size2 = 9;
$font_size3 = 7;
$font_angle = 0;
$height = 50;
if(strlen($txt) >100){
$txt = substr($txt,0,100);
}
// (C) TEXT BOX SIZE
// imagettfbbox(FONT SIZE, ANGLE, FONT, TEXT)
$text_size = imagettfbbox($font_size1, $font_angle, $font, $txt);
$text_width = max([$text_size[2], $text_size[4]]) - min([$text_size[0], $text_size[6]]);
$text_height = max([$text_size[5], $text_size[7]]) - min([$text_size[1], $text_size[3]]);
//check the name
$text_size = imagettfbbox($font_size1, $font_angle, $font, $txtName);
$text_width2 = max([$text_size[2], $text_size[4]]) - min([$text_size[0], $text_size[6]]);
//check the date
$text_size = imagettfbbox($font_size1, $font_angle, $font, $txtDate);
$text_width3 = max([$text_size[2], $text_size[4]]) - min([$text_size[0], $text_size[6]]);
if($text_width > $text_width2){
$temp = $text_width;
}else{
$temp = $text_width2;
}
if($text_width3 > $temp){
$temp = $text_width3;
}
$width = $temp+50;
// (B) IMAGE OBJECT + COLORS
$img = imagecreate($width, $height+40);
$grey = imagecolorallocate($img, 200, 200, 200);
$black2 = imagecolorallocate($img, 0,128,0);
$black = imagecolorallocate($img, 120,120,120);
imagefilledrectangle($img, 0, 0, $width, $height, $grey);
//imagefilledrectangle($img, 0, 0, $width-10, $height, $blue);
// (D) CENTERING THE TEXT BLOCK
$centerX = CEIL(($width - $temp) / 2);
$centerX = $centerX<0 ? 0 : $centerX;
$centerY = CEIL(($height - $text_height) / 2);
$centerY = $centerY<0 ? 0 : $centerY;
imagettftext($img, $font_size1, $font_angle, $centerX, $centerY, $black2, $font, $txtName);
imagettftext($img, $font_size2, $font_angle, $centerX, $centerY+20, $black, $font, $txt);
imagettftext($img, $font_size3, $font_angle, $centerX, $centerY+40, $black, $font, $txtDate);
$ext ="png";
//echo $ext;
$tempemail = str_replace('.', '', $email);
$tempfilename = $tempemail . time() . '_' . uniqid(rand(), true);
//echo $tempfilename;
$tempfilename = str_replace('.', '', $tempfilename);
$filename_unique = $tempfilename . '.'.$ext;
$file_url ="https://chatme24.com/penpalamerica/upload/php/replymessage/".$filename_unique;
$file_url2 ="../penpalamerica/upload/php/replymessage/".$filename_unique;
echo $file_url;
imagepng($img,$file_url2);
imagedestroy($img);
?>