|
 |
|
สอบถามเรื่องการอัพไฟล์รูปภาพลงเว็บบอร์ดทีละหลายๆภาพนะคับ มี code ให้ดูคับ ช่วยหน่อย |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
function showAttachfile ($imagename)
{
if($imagename<>"")
{
$imagesize = getimagesize ("attach/$imagename.jpg");
if($imagesize[0]>$imagesize[1])
{
if($imagesize[0]> 400)
{
$w = 400;
$h = ($imagesize[1]*400)/$imagesize[0];
} else
{
$w = $imagesize[0];
$h = $imagesize[1];
}
} else
{
if($imagesize[0] > 400)
{
$w = 400;
$h = ($imagesize[0]*400)/$imagesize[1];
}else
{
$w = $imagesize[0];
$h = $imagesize[1];
}
}
$output = "<img src=\"attach/$imagename.jpg\" width=\"$w\" height=\"$h\" />";
} else
{
$output = " ";
}
return $output;
}
function showIP ($ipaddress)
{
if($ipaddress<>"::1")
{
$tmpSplit = split("\.",$ipaddress);
$output = $tmpSplit[0] .".".$tmpSplit[2].".xxx";
}else
{
$output = "127.0.0.xxx";
}
return $output;
}
function badword($detail)
{
$word = array("fuck","suck");
$detail = str_replace ($word,"<font color=red>***</font>",$detail);
return $detail;
}
function dateshow($datetime)
{
$monthname = array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec");
$monthnum = array("01","02","03","04","05","06","07","08","09","10","11","12");
$tmpSplit = split(" ",$datetime);
$datetime = $tmpSplit[0];
$datetime = $tmpSplit[1];
$splitDate = split("-",$datadate);
$output = $splitDate[2]." ".str_replace($monthnum, $monthname, $splitDate[1])." ".$splitDate[0].' '.$datatime;
return $output;
}
?>
อยากทราบทำยังไงถึงจะเพิ่มไฟล์รูปภาพได้อ่ะคับ ต้องแก้ตรงไหนยังไง
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2012-02-08 15:56:56 |
By :
jui |
View :
901 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันนี้น่าจะเป็น function สำหรับ Show ครับ ไม่น่าจะเกี่ยวกับตรงนี้ครับ
|
 |
 |
 |
 |
Date :
2012-02-08 17:47:05 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|