|
 |
|
โหลด webboard text มาแล้วมันบังคับให้ใส่รูปทุกครั้งที่โพส |
|
 |
|
|
 |
 |
|
ลองค้นกะทู้เก่าๆแล้วคับ มีคนบอกว่าให้ไปลบ code ส่วนที่ใช้ตรวจสอบเกี่ยวกับการโพสรูปแล้วลบทิ้ง
แต่พอลบแล้วมันขึ้น error ตลอดเลย
ผมลบที่ไฟล์ function.php ที่หัวข้อที่ 6 ตามsource ตั้งแต่บรรทัดหลัง include จนถึง หัวข้อส่งรูปได้ไม่เกิน 50 k
//(6) ฟังก์ชั่นตรวจสอบการส่งรูป และ copy รูปไว้ในไดเรคทอรี่
function Send_Img($Type, $No, $Upload_Img, $Upload_Img_type, $Upload_Img_size) {
include("./config.inc.php"); //ตั้งค่าต่างๆของเวปบอร์ด
if($Upload_Img!="none") { // ถ้ามีการส่งรูปมาด้วย
if($Upload_Img_type=="image/gif") {
$imgfiles=".gif"; //ถ้าไฟล์ที่ส่งมาเป็นไฟล์ .gif ให้มีสกุลไฟล์เป็นตามที่กำหนดนี้
}
else if( ($Upload_Img_type=="image/jpg") || ($Upload_Img_type=="image/jpeg") || ($Upload_Img_type=="image/pjpeg")) {
$imgfiles=".jpg"; //ถ้าไฟล์ที่ส่งมาเป็นไฟล์ .jpg ให้มีสกุลไฟล์เป็นตามที่กำหนดนี้
}
else {
echo Message(35,"red","ไม่ใช่ไฟล์รูปภาพ .gif หรือ .jpg","กรุณาตรวจสอบด้วยครับ","<a href='javascript:history.back(1)'> กลับไปแก้ไข </a>");
exit();
}
// ส่งรูปได้ไม่เกิน 50 Kb
if($Upload_Img_size>51200) {
echo Message(35,"red","ขนาดของรูปเกินกว่าที่กำหนด","กรุณาตรวจสอบด้วยครับ","<a href='javascript:history.back(1)'> กลับไปแก้ไข </a>");
exit();
}
// ตรวจสอบความกว้างของรูป
$size = getimagesize($Upload_Img);
if($size[0] > 600) { //ถ้าความกว้างมากกว่า 600 pixels
echo Message(35,"red","ความกว้างของรูปมากกว่า 600 pixels","กรุณาแก้ไขด้วยครับ","<a href='javascript:history.back(1)'>กลับไปแก้ไข</a>");
exit();
}
// ตรวจสอบว่ามีไดเรคทอรี่ชื่อ imagefiles อยู่หรือไม่ ถ้าไม่มีให้สร้างขึ้นใหม่
$DirOK = 0;
$DIR = opendir("./$dataDir/");
while ($text = readdir($DIR)){
if($text == "imagefiles") $DirOK = 1;
}
if(!$DirOK) mkdir("./$dataDir/imagefiles/",0777);
// ถ้าเป็นการส่งรูปจากการตอบ (เนื่องจากการตอบจะตอบได้หลายคนและอาจจะส่งมาหลายรูป)
if($Type){
// อ่านจำนวนของรูปจากไฟล์
$filename = "./$dataDir/imagefiles/Img$No.txt";
if(file_exists($filename)) {
$FILE=fopen($filename,"rt");
$num=fgets($FILE,10);
fclose($FILE);
}
else{
$num=0;
}
$num++; //เพิ่มค่าขึ้น 1
// บันทึกค่าจำนวนรูปลงในไฟล์ดังเดิม ด้วยค่าใหม่
$FILE=fopen($filename,"w");
flock($FILE,2);
fputs($FILE,$num);
flock($FILE,3);
fclose($FILE);
$ImgName = "R$No-$num$imgfiles";
}
else {
$ImgName = "$No$imgfiles";
}
// copy ไฟล์รูปไปเก็บไว้ในไดเรคทอรี่
copy($Upload_Img,"./$dataDir/imagefiles/$ImgName");
return ($ImgName);
} // จบการตรวจสอบ ว่าส่งรูปมาหรือเปล่า
else {
return (0);
}
} // จบฟังก์ชั่น
แต่ก็ติด error ตลอดเลย ไม่รู้ทำผิดหรือป่าว ช่วยแนะนำทีคับ 
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
8 ก.ย. 2548 15:42:29 |
By :
kazamaturi |
View :
2718 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ให้แก้ข้อความตรงส่วนนี้ครับ
จากเดิม
if($Upload_Img!="none") { // ถ้ามีการส่งรูปมาด้วย
ให้เป็น
if($Upload_Img!="") { // ถ้ามีการส่งรูปมาด้วย
เท่านี้ก็จะใช้ได้ครับ

|
 |
 |
 |
 |
Date :
16 ก.ย. 2548 09:11:57 |
By :
หนูจัมมัย |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|