 |
|
Code (PHP)
function reszieimg($a){
$HTTP_POST_FILES['img']['name']="120.jpg";
$HTTP_POST_FILES['img']['tmp_name']="$a";//iรับจากrssลิ้งที่อยู่รูป
$path = "img_new" ;
if(!is_dir($path)){
mkdir($path,0777) ; }
$Upload_name=$HTTP_POST_FILES['img']['name'];
$Path_Upload_server=$HTTP_POST_FILES['img']['tmp_name'];
$rand = rand(11111,99999); // random ? 1-9 ?
$new_name=$rand.$Upload_name;
$img_new="$path/$new_name";
move_uploaded_file($Path_Upload_server,$img_new);
$size=GetimageSize($Path_Upload_server);
$images_orig = ImageCreateFromJPEG($Path_Upload_server);
$photoX = ImagesX($images_orig);
$photoY = ImagesY($images_orig);
$images_fin = ImageCreateTrueColor(50,50);
ImageCopyResampled($images_fin, $images_orig, 0, 0, 0, 0, $width+1, $height+1, $photoX, $photoY);
ImageJPEG($images_fin,$img_new);
ImageDestroy($images_orig);
ImageDestroy($images_fin);
return $img_new;
}
|
 |
 |
 |
 |
Date :
2011-07-18 22:46:30 |
By :
ckcr |
|
 |
 |
 |
 |
|
|
 |