<html>
<head>
<title>ThaiCreate.Com PHP Upload Add Images</title>
</head>
<body>
<?php
if(trim($_FILES["fileUpload"]["tmp_name"]) != "")
{
$myImage = imagecreatefromjpeg($_FILES["fileUpload"]["tmp_name"]);
$myCopyright = imagecreatefromjpeg('thaicreate.jpg');
copy($_FILES["fileUpload"]["tmp_name"],"MyResize/".$_FILES["fileUpload"]["name"]);
$destWidth = imagesx($myImage);
$destHeight = imagesy($myImage);
$srcWidth = imagesx($myCopyright);
$srcHeight = imagesy($myCopyright);
$destX = ($destWidth - $srcWidth) / 2;
$destY = ($destHeight - $srcHeight) / 1;
$white = imagecolorexact($myCopyright, 255, 255, 255);
imagecolortransparent($myCopyright, $white);
imagecopymerge($myImage, $myCopyright, $destX, $destY, 0, 0, $srcWidth, $srcHeight, 50);
imagejpeg($myImage,"MyResize/image.jpg");
imagedestroy($myImage);
imagedestroy($myCopyright);
}
?>
<b>Original</b><br>
<img src="<?php echo "MyResize/".$_FILES["fileUpload"]["name"];?>">
<hr>
<b>New Images</b><br>
<img src="<?php echo "MyResize/image.jpg";?>">
</body>
</html>