|
|
|
php ทำอย่างไรก็ resize รูปไม่ได้สักทีรบกวนดูให้หน่อยค่ะว่าเป็นเพราะอะไรค่ะ |
|
|
|
|
|
|
|
Code (PHP)
$fileupload = $_FILES['filUpload']['tmp_name'];
$fileType = $_FILES["filUpload"]["type"];
if(($fileType=="image/gif") || ($fileType=="image/jpeg") || ($fileType == "image/pjpeg") or $fileType == "")
{
//*** Update Record ***/
$strSQL = "UPDATE tblcatalogue_store ";
$strSQL .=" SET name_before_photo1 = '".$_POST["txtName"]."' WHERE id_catalogue_store= '".$_GET["id_catalogue_store"]."' ";
$objQuery = mysql_query($strSQL);
if($_FILES["filUpload"]["name"] != "" )
{
$images = $_FILES["fileUpload"]["tmp_name"];
$new_images = "Thumbnails_".$_FILES["fileUpload"]["name"];
move_uploaded_file($_FILES["fileUpload"]["tmp_name"],"photo/".$_FILES["fileUpload"]["name"]);
$width=100; //*** 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,"photo/".$new_images);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
//*** Delete Old File ***/
/*@unlink("photo/".$_POST["hdnOldFile"]);
//*** Update New File ***/
$strSQL = "UPDATE tblcatalogue_store ";
$strSQL .=" SET before_photo1 = '".$_FILES["filUpload"]["name"]."' WHERE id_catalogue_store = '".$_GET["id_catalogue_store"]."' ";
$objQuery = mysql_query($strSQL);
?>
<tr>
<td colspan="2" align="center"><font color="#000000" size="5" face="Arial, Helvetica, sans-serif">แก้ไขเรียบร้อยแล้ว</font></td>
</tr>
<?
}
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2011-10-11 16:58:10 |
By :
deedee2338 |
View :
795 |
Reply :
8 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ปุ่มที่จะมาก่อนนหน้านี้ ที่เป้น browse อ่ะครับ มีชื่อว่าอะไรครับ เพระาดูจาก กระทู้เก่าของคุณมันคือ fileupload
ดังนั้นจึงอยากรู้ว่าตอนนี้ของคุณมันคืออะไรครับ
|
|
|
|
|
Date :
2011-10-11 17:07:49 |
By :
grandraftz |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ชื่อนี้ค่ะ
Code (PHP)
<td ><input type="file" name="fileUpload"></td>
<input type="hidden" name="hdnOldFile" value="<?=$objResult["before_photo1"];?>">
|
|
|
|
|
Date :
2011-10-12 08:11:34 |
By :
deedee2338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
encype มาหรือยังครับ
|
|
|
|
|
Date :
2011-10-12 09:48:28 |
By :
Dragons_first |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
แล้วถ้าจะลบThumbnails ออกต้องทำไงค่ะ
|
|
|
|
|
Date :
2011-10-12 15:19:37 |
By :
deedee2338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
error แบบนี่ตลอดเลย
Warning: Division by zero in C:\AppServ\www\test1.php on line 104
Warning: imagesx(): supplied argument is not a valid Image resource in C:\AppServ\www\test1.php on line 106
Warning: imagesy(): supplied argument is not a valid Image resource in C:\AppServ\www\test1.php on line 107
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\AppServ\www\test1.php on line 108
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\AppServ\www\test1.php on line 109
Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\AppServ\www\test1.php on line 110
Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\AppServ\www\test1.php on line 111
Warning: imagedestroy(): supplied argument is not a valid Image resource in C:\AppServ\www\test1.php on line 112
|
|
|
|
|
Date :
2011-10-12 15:45:11 |
By :
deedee2338 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|