Register Register Member Login Member Login Member Login Forgot Password ??
PHP (Hypertext Preprocessor), ASP (Active Server Pages), ASP.NET, VB.NET, C# (.Net 1.1, 2.0, 3.5, 4.0)
   
 

Registered : 86,976

 
 
HOME > PHP > PHP Image (GD) > PHP Upload and Resize Image

PHP Upload and Resize Image

 
 


ลองใช้ค้นหาข้อมูล


   

Bookmark.
PHP Upload and Resize Image เป็นการ Upload ไฟล์และทำการ Resize รูปภาพในรูปแบบของ Thumbnails

PHP & GD



phpUploadResize.html

<html>
<head>
<title>ThaiCreate.Com PHP Upload Resize</title>
</head>
<body>
<form action="phpUploadResize.php" method="post" enctype="multipart/form-data" name="frmMain">
<table width="343" border="1">
<tr>
<td>Upload</td>
<td><input name="fileUpload" type="file"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Submit"></td>
</tr>
</table>
</form>
</body>
</html>



phpUploadResize.php

<html>
<head>
<title>ThaiCreate.Com PHP Upload Resize</title>
</head>
<body>
<?
	if(trim($_FILES["fileUpload"]["tmp_name"]) != "")
	{
		$images = $_FILES["fileUpload"]["tmp_name"];
		$new_images = "Thumbnails_".$_FILES["fileUpload"]["name"];
		copy($_FILES["fileUpload"]["tmp_name"],"MyResize/".$_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,"MyResize/".$new_images);
		ImageDestroy($images_orig);
		ImageDestroy($images_fin);
	}
?>
<b>Original Size</b><br>
<img src="<?="MyResize/".$_FILES["fileUpload"]["name"];?>">
<hr>
<b>New Resize</b><br>
<img src="<?="MyResize/".$new_images;?>">
</body>
</html>



PHP GD

PHP GD

PHP GD




Link แนะนำ ที่ควรศึกษา





ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท

  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rate :  
  Create/Update Date : 2008-08-10 10:51:26 / 2009-02-01 09:32:54
  View : 40,367
  Download : Download  PHP Upload and Resize Image
Sponsored Links
 
 
Thanks. Our Sponsor.
Download Mozilla Firefox
 
Ads Contact : 08-1987-6107
 Sponsored Links


 
PHP GD
Rate : View : 17,893
PHP Create Image
Rate : View : 17,166
PHP Create text in image
Rate : View : 18,169
PHP Write text in Image
Rate : View : 13,593
PHP Upload and write text in image
Rate : View : 14,514
PHP Add Logo/CopyRight to Image (Watermark)
Rate : View : 14,620
PHP Upload and Add Logo to image
Rate : View : 14,367
PHP Resize image
Rate : View : 25,455
PHP Resize Thumbnails Image and Insert to MySQL
Rate : View : 21,203
PHP Multiple Upload & Multiple Resize to MySQL
Rate : View : 23,321
ThaiCreate.Com Forum
ThaiCreate.Com Forum คลังกระทู้
บทความโดยสมาชิก
PHP Forum ASP Forum
.NET Forum Graphic Forum
Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools



 

© www.ThaiCreate.Com. 2003-2011 All Rights Reserved. Link : ไทยกู๊ดเว็บ , ติดแก๊ส , Promote Website
Comments & Suggestions Please Contact Us : thaicreate at hotmail dot com [Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่

Inline