| Server IP : 104.21.37.246 / 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 : /home2/cp648411/public_html/kainumber.com/taro/Watermark/ |
Upload File : |
<?php
//By aPinan
//GPL License
//Have fun..!
function watermarkImage_1 ($SourceFile, $WaterMarkText, $DestinationFile) {
putenv('GDFONTPATH=' . realpath('.'));
list($width, $height) = getimagesize($SourceFile);
$image_p = imagecreatetruecolor($width, $height);
$image = imagecreatefromjpeg($SourceFile);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $width, $height, $width, $height);
$black = imagecolorallocate($image_p, 255, 0, 0);//กำหนดสี
// $font = 'THA0006.ttf';//กำหนดชื่อฟอนต์
$font = 'eak_khunwai.ttf';
$font_size = 56; //กำหนดขนาดฟอนต์
imagettftext($image_p, $font_size, 0, 12, 50, $black, $font, $WaterMarkText);
//อธิบาย imagettftext($image_p,ขนาดฟอนต์,องศ์ษา,แนวนอน,แนวตั้ง,สี,ชื่อฟอร์ตที่ใช้,ข้อความ);
if ($DestinationFile<>'') {
imagejpeg ($image_p, $DestinationFile, 100);
} else {
header('Content-Type: image/jpeg');
imagejpeg($image_p, null, 100);
};
imagedestroy($image);
imagedestroy($image_p);
};
?>