|
 |
|
ปัญหาการอัพโหลดรูปภาพ Allowed memory size of 25165824 bytes exhausted (tried to allocate 1944 bytes) |
|
 |
|
|
 |
 |
|
ผมได้ทำการอัพโหลดรูป
และได้มีการฟ้อง
Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 1944 bytes)
in C:\AppServ\www\www\add_book2.php on line 89
หน้า add_book2.php
Code (PHP)
<?
//upload image 1
for($i=0;$i<count($_FILES["fileUpload"]["name"]);$i++)
{
if(trim($_FILES["fileUpload"]["tmp_name"][$i]) != "")
{
$images = $_FILES["fileUpload"]["tmp_name"][$i];
$new_images = $_FILES["fileUpload"]["name"][$i];
//mkdir("MyResize/".$_POST['txtUsername']);
// Place image in the folder
//mkdir("images/$pid", 0700); //สร้างโฟลเดอร์
//$newname = $fileUpload."_im.jpg";
//copy($_FILES["fileUpload"]["tmp_name"][$i],"MyResize/".$_POST['txtUsername']."/".$_FILES["fileUpload"]["name"][$i]);
//move_uploaded_file( $_FILES['fileUpload']['tmp_name'],"MyResize/".$_FILES["fileUpload"]["name"][$i]);
copy($_FILES["fileUpload"]["tmp_name"][$i],"MyResize/$txtUsername"."_1_".$_FILES["fileUpload"]["name"][$i]);
//copy($_FILES["fileUpload"]["tmp_name"][$i],"MyResize/".$_FILES["fileUpload"]["name"][$i]);
$width=640; //*** Fix Width & Heigh (Autu caculate) ***//
$size=GetimageSize($images);
$height=round($width*$size[1]/$size[0]);
$images_orig = ImageCreateFromJPEG($images);
$photoX = ImagesX($images_orig);
$photoY = ImagesY($images_orig);
$images_fin = ImageCreateTrueColor($width, $height);
ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
//ImageJPEG($images_fin,"MyResize/".$_POST['txtUsername']."/".$_FILES["fileUpload"]["name"].$new_images);
ImageJPEG($images_fin,"MyResize/$txtUsername".$new_images);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
//User Make No Echo
//echo "Resize Successful.<br>";
//*** Insert Record ***//
$objConnect = mysql_connect("localhost","library","compaq") or die("Error Connect to Database");
$objDB = mysql_select_db("library");
$strSQL = "INSERT INTO book_image";
$strSQL .="(image_path,book_isbn,image_type) VALUES
('"."MyResize/".$_POST['txtUsername']."_1_".$_FILES["fileUpload"]["name"][$i]."','".$_POST['txtUsername']."','1')";
//('".$new_images."','".$_FILES["fileUpload"]["name"][$i]."','".$_POST['txtUsername']."')";
$objQuery = mysql_query($strSQL) or die(mysql_error());
}
}
//end upload image 1
?>
รบกวนพี่ๆ หน่อยครับ
มีทางแก้ ยังไงบ้าง ครับผม
Tag : PHP, MySQL, HTML/CSS, JavaScript, Ajax, jQuery

|
|
 |
 |
 |
 |
Date :
2012-04-02 16:02:59 |
By :
วรัญญู นาคะเวช |
View :
1200 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
กระทู้เก่าๆ มีเยอะมาก ค้นหาก็เจอแล้วครับ
|
 |
 |
 |
 |
Date :
2012-04-02 19:42:17 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|