|
 |
|
อัพรูป jpg ละเป็นสีดำอะงับ ช่วยที HELP MEeeeeeeeeeeeeeeee |
|
 |
|
|
 |
 |
|
รูป jpg เป็นสีดำอะงับ ช่วยที
<?
$Act=$_GET['Act'];
switch($Act){
case 'Add' : $CatName=$_POST['CatName'];
$StockLimit=$_POST['StockLimit'];
$Picture_Tmp=$_FILES['Picture']['tmp_name'];
$Date=date('Y-m-d');
$S=date("s");
$Check=Select("ecom_category","WHERE CatName='".$CatName."'");
$Num_Rows=Num_Rows($Check);
if($Num_Rows == 0){
$Insert=Insert("ecom_category","CatName,StockLimit,Date","'".$CatName."','".$StockLimit."','".$Date."'");
if($Insert){
$Select=Select("ecom_category","WHERE CatName='".$CatName."' AND StockLimit='".$StockLimit."'");
$Cat=mysql_fetch_array($Select);
if($Cat){
$Rename=$Cat['CatId']."-".$S.".jpg";
$ResizePicture=ResizePicture($Picture_Tmp,$Rename,180,"picture/category/");
if($ResizePicture != ""){
$Update=Update("ecom_category","Picture='".$Rename."' WHERE CatId='".$Cat['CatId']."'");
if($Update){
echo "<script language=\"javascript\">";
echo "alert('ระบบทำการเพิ่มหมวดสินค้า ".$CatName." เรียบร้อย');";
echo "window.location='ecom_category.php';";
echo "</script>";
}
}
}
}
}else{
echo "<script language=\"javascript\">";
echo "alert('หมวดสินค้า ".$CatName." มีอยู่ในระบบแล้ว');";
echo "window.location='ecom_add_category.php';";
echo "</script>";
}
}
?>
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2014-02-16 20:22:39 |
By :
SOOAA |
View :
867 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
//========= Function ResizePicture) =========
function ResizePicture($Picture_Tmp,$Rename,$Height,$Path){
$Size=getimagesize($Picture_Tmp);
$SizeX=$Size[0];
$SizeY=$Size[1];
$Weight=ceil($SizeX*$Height)/$SizeY;
$Image_Fin=imagecreatetruecolor($Weight,$Height);
$Image_Ori=imagecreatefrompng($Picture_Tmp); // เปลี่ยนส่วนนี้เป็น jpeg
$ImageX=imagesx($Image_Ori);
$ImageY=imagesy($Image_Ori);
imagecopyresampled($Image_Fin,$Image_Ori,0,0,0,0,$Weight,$Height,$ImageX,$ImageY);
imagepng($Image_Fin,$Path.$Rename); // เปลี่ยนส่วนนี้เป็น jpeg
imagedestroy($Image_Fin);
imagedestroy($Image_Ori);
$Complate="Complate";
return $Complate;
}
|
ประวัติการแก้ไข 2014-02-17 10:16:55
 |
 |
 |
 |
Date :
2014-02-17 10:16:18 |
By :
Ex-[S]i[L]e[N]t |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|