|
|
|
เกี่ยวกับ Uploadfile ลายน้ำ ครับ ทำไมรูปมันขึ้นใน folder 2 รูป ไม่เข้าใจ |
|
|
|
|
|
|
|
Code (PHP)
<?
include ("config.php");
$itm_pic_tmp_name=$_FILES['file']['tmp_name'];
$itm_pic_nane=$_FILES['file']['name'];
$itm_pic_size=$_FILES['file']['size']/1024/1024;
$itm_pic_type=$_FILES['file']['type'];
if(trim($itm_pic_tmp_name) != "")
{
$myImage = imagecreatefromjpeg($itm_pic_tmp_name);
$myCopyright = imagecreatefromjpeg('pic/d.jpg');
if (move_uploaded_file($itm_pic_tmp_name, "pic/$itm_pic_nane")) {
$pic_new="pic"."-".date("ymd-His")."-".rand(0000001,999999);
$file_type=substr($itm_pic_nane,-3);
$pic_new="$pic_new.$file_type";
$destWidth = imagesx($myImage);
$destHeight = imagesy($myImage);
$srcWidth = imagesx($myCopyright);
$srcHeight = imagesy($myCopyright);
$destX = ($destWidth - $srcWidth) /2;
$destY = ($destHeight - $srcHeight) / 2;
$white = imagecolorexact($myCopyright, 800, 800, 800);
imagecolortransparent($myCopyright, $white);
imagecopymerge($myImage, $myCopyright, $destX, $destY, 0, 0, $srcWidth, $srcHeight, 50);
imagejpeg($myImage,"pic/$pic_new");
imagedestroy($myImage);
imagedestroy($myCopyright);
} else {}
}
$sql="INSERT INTO test (file) VALUES ('$pic_new')";
mysql_query('SET NAMES UTF8');
$sqlquery=mysql_db_query($DBName,$sql) or die("ติดต่อฐานข้อมูลไม่ได้");
mysql_close();
?>
รบกวนด้วยนะครับ
Tag : PHP
|
|
|
|
|
|
Date :
2014-07-10 16:29:54 |
By :
maxvit |
View :
743 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+1
|
|
|
|
|
Date :
2014-07-11 12:04:12 |
By :
maxvit |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2014-07-14 09:22:41 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|