php里我定义了三个图片尺寸分别为宽度和高度为50、100和200像素这个你们自己根据需求修改
<?php
/**
* php修改上传图片的尺寸
* @author veer
* @mail veer.mr@qq.com
*/
header("Content-Type: text/html; charset=UTF-8");
$file = $_FILES['file'];
if($file){
include_once('function_image.php');
if(!$fileext = check_ispic($file)){
echo '上传的不是图片';
exit;
}
$attachdir = 'upload/';
$new_name = $attachdir.'beautiful.'.$fileext;
$uploadfiles = file_save($file,$new_name);
$data = array();
if($uploadfiles){
$thumbimgs = array(
'small'=>array('suffix'=>'.thumb.jpg','width'=>50,'height'=>50),
'middle'=>array('suffix'=>'.thumb.jpg.m.jpg','width'=>100,'height'=>100),
'big'=>array('suffix'=>'.thumb.jpg.b.jpg','width'=>200,'height'=>200),
);
foreach ($thumbimgs as $key3=>$val3){
$dstfile = $new_name.$val3['suffix'];
$tow = $val3['width'];
$toh = $val3['height'];
$thumbstatus = publicthumb($new_name,$dstfile,$tow,$toh,0);
if($thumbstatus){
$imgg = radius_img($dstfile, $tow/2);
imagejpeg($imgg,$dstfile);
imagedestroy($imgg);
$data[$key3] = $dstfile;
}
}
}
}
?>