 |
|
Code (PHP)
if(trim($_FILES["upload_image"]["tmp_name"]) != "")
{
$images = $_FILES["upload_image"]["tmp_name"];
$new_images =$Form_ID.$_FILES["upload_image"]["name"];
$type = substr($_FILES['upload_image']['name'],-4); // substr ค่าที่ได้จะเป็น .jpg,.png,.gif
$new_images=$Form_ID.$type; // ตั้งชื่อไพล์ตามรหัส Form_ID
copy($_FILES["upload_image"]["tmp_name"],"upload/".$_FILES["upload_image"]["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,"upload/".$new_images);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
Tag : PHP
|
|
 |
 |
 |
 |
Date :
2013-05-22 12:48:30 |
By :
โต้ง |
View :
722 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |