|
 |
|
เวลาอัพรูปแล้วรีไซส์ มันฟ้องงี้อ่ะครับ ... ภาพ error เวลาอัพรูป ... ImageCreateTrueColor .. ImageCopyResampled .. |
|
 |
|
|
 |
 |
|
Code (PHP)
<?
//ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:index.php');
exit();
}
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล
require_once('../script/connect.php');
require_once('../script/function.php');
require_once('../script/check.php');
require_once('../script/function.php');
$strSQL = "Select * From picture Where TourID = '$_POST[TourID]'";
$result = mysql_query( $strSQL);
// หาจำนวนเรกคอร์ดข้อมูลในตาราง
$num_rows = mysql_num_rows($result);
?>
<?php
if(isset($_REQUEST['Submit'])&&($_REQUEST['Submit']=="AddPicture"))
{
$passw = random_password(7);
$filenewcon = strstr($_GET[file_name],'.');
$now = date("Dgis");
$pic="$passw$now$filenewcon";
$images = $_GET["file"];
//กำหนดความสูงของรูปใหม่
$height=129;
$size=GetimageSize($images);
$width=round($height*$size[0]/$size[1]);
$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,"../gallery/$pic");
ImageDestroy($images_orig);
ImageDestroy($images_fin);
//กำหนดความสูงของรูปใหม่
$height=600;
$size=GetimageSize($images);
$width=round($height*$size[0]/$size[1]);
$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,"../postcard/$pic");
ImageDestroy($images_orig);
ImageDestroy($images_fin);
$query22= "INSERT INTO picture (PictureName,PictureDetail,TourID) VALUES('$pic','$_POST[PictureDetail]','$_POST[TourID]')";
$add_course= mysql_query($query22);
if($add_course<>0)
{
echo("<meta http-equiv='refresh' content='0;URL=addpicture.php?TourID=$_POST[TourID]'>");
}
}
?>

Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-01-07 19:56:53 |
By :
nongjen |
View :
1287 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
warning:getiagesize() [funtion.getimagesize]: Filnename cannot be empty in ....
ลองเช็คไฟล์รูปดูใหม่ครับ directory path ถูกเปล่า
$images = $_GET["file"]; << แน่ใจน่ะว่ารับแบบ$_GET
ไม่รู้ว่า file เป็น input แบบไหนส่งค่า http แบบไหน ลองเช็คใหม่
$images =$_FILES['file']; << ถ้ารับมาแบบ file upload ใช้อันนี้
$images=$_POST['file']; << ถ้า form ส่งแบบ post ก็ใช้อันนี้
|
 |
 |
 |
 |
Date :
2010-01-07 20:15:15 |
By :
xbeginner01 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
[php]<?
//ob_start();
session_start();
if($_SESSION["adminlogin"]=="")
{
header('location:index.php');
exit();
}
//============ Start Session และทำการเรียก Function ติดต่อฐานข้อมูล
require_once('../script/connect.php');
require_once('../script/function.php');
require_once('../script/check.php');
require_once('../script/function.php');
$strSQL = "Select * From picture Where TourID = '$_POST[TourID]'";
$result = mysql_query( $strSQL);
// หาจำนวนเรกคอร์ดข้อมูลในตาราง
$num_rows = mysql_num_rows($result);
?>
<?php
if(isset($_REQUEST['Submit'])&&($_REQUEST['Submit']=="AddPicture"))
{
$passw = random_password(7);
$filenewcon = strstr($file_name,'.');
$now = date("Dgis");
$pic="$passw$now$filenewcon";
$images = $_GET['file'];
//กำหนดความสูงของรูปใหม่
$height=129;
$size=GetimageSize($images);
$width=round($height*$size[0]/$size[1]);
$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,"../gallery/$pic");
ImageDestroy($images_orig);
ImageDestroy($images_fin);
//กำหนดความสูงของรูปใหม่
$height=600;
$size=GetimageSize($images);
$width=round($height*$size[0]/$size[1]);
$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,"../postcard/$pic");
ImageDestroy($images_orig);
ImageDestroy($images_fin);
$query22= "INSERT INTO picture (PictureName,PictureDetail,TourID) VALUES('$pic','$_POST[PictureDetail]','$_POST[TourID]')";
$add_course= mysql_query($query22);
if($add_course<>0)
{
echo("<meta http-equiv='refresh' content='0;URL=addpicture.php?TourID=$_POST[TourID]'>");
}
}
?>
<?php
if(isset($_REQUEST['Submit2'])&&($_REQUEST['Submit2']=="EditPicture"))
{
$pic=$_GET[s_image];
$images = $_GET["file"];
//กำหนดความสูงของรูปใหม่
$height=129;
$size=GetimageSize($images);
$width=round($height*$size[0]/$size[1]);
$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,"../gallery/$pic");
ImageDestroy($images_orig);
ImageDestroy($images_fin);
//กำหนดความสูงของรูปใหม่
$height=600;
$size=GetimageSize($images);
$width=round($height*$size[0]/$size[1]);
$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,"../postcard/$pic");
ImageDestroy($images_orig);
ImageDestroy($images_fin);
$sql_user = "update picture set PictureName='$pic',PictureDetail='$_POST[PictureDetail]' where PictureName='$_POST[ID]'";
$result_user = mysql_query($sql_user);
if($result_user<>0){
echo("<meta http-equiv='refresh' content='0;URL=addpicture.php?TourID=$_POST[TourID]'>");
}
}
?>
<?
if(isset($_GET["ID"])){
if($_GET["do"]=="del"){
// ลบข้อมูลเหตุการณ์จากตาราง mycalendar
$querydeletestudent ="DELETE FROM picture WHERE PictureName='$_GET[ID]' ";
$result_student = mysql_query($querydeletestudent);
@unlink("../gallery/$_GET[ID]");
@unlink("../postcard/$_GET[ID]");
echo("<meta http-equiv='refresh' content='0;URL=addpicture.php?TourID=$_GET[TourID]'>");
}
}
?>
<?
$query1="select * from picture where PictureName='$_GET[ID]'";
$rscourseID1 = mysql_query($query1);
$total1 = mysql_fetch_assoc($rscourseID1);
?>
|
 |
 |
 |
 |
Date :
2010-01-07 20:45:15 |
By :
nongjen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|

ถ้าฟอร์ม รับรูปเป็นแบบนี้มต้องรับยังไงเหรอครับ
warning:getiagesize() [funtion.getimagesize]: Filnename cannot be empty in ....
ลองเช็คไฟล์รูปดูใหม่ครับ directory path ถูกเปล่า
$images = $_GET["file"]; << แน่ใจน่ะว่ารับแบบ$_GET
ไม่รู้ว่า file เป็น input แบบไหนส่งค่า http แบบไหน ลองเช็คใหม่
$images =$_FILES['file']; << ถ้ารับมาแบบ file upload ใช้อันนี้
$images=$_POST['file']; << ถ้า form ส่งแบบ post ก็ใช้อันนี้
|
 |
 |
 |
 |
Date :
2010-01-07 21:33:07 |
By :
nongjen |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|