Because thinkphp3.2.3 does not have a uploadfile,uploadimage class, it needs to be extracted from the expansion pack and added to it, putting them in the Thinkphp\library\think directory.
Private Function_upload ($path, $width, $height)//Private method standard naming method_fun (){$obj =New\think\uploadfile ();//Instantiate file Upload class$objmaxSize= C (' Upload_max_size ');//picture max upload size$objSavepath= C (' Upload_path '). $path.'/';//File Upload save path$objSaverule=' Uniqid ';//Save file name$objallowexts= C (' Upload_ext ');//file allows uploading of suffixes$objThumb=true;//generate thumbnail images$objUploadreplace=true;//overwrite files with the same name$objThumbmaxwidth= $width;//the width of the thumbnail image$objThumbmaxheight= $height;//the height of the thumbnail image$objThumbprefix=' Max_,medium_,mini_ ';//thumbnail prefix name, multiple comma separated$objThumbpath= $objSavepath. Date (' Y_m ').'/';//thumbnail save path is the same as the upload path$objThumbremoveorigin=true;//Delete Original$objautosub=true;//automatically generate subdirectories to save files$objsubtype=' Date ';//Use date format to name subdirectories, default isHash$objDateFormat=' Y_m ';//Use year_Month format name subfolderif(! $obj->upload ()) {// Upload error messageEchoJson_encode (Array(' msg '= $this->error ($obj->geterrormsg ()),' status '= 0)); }Else{// upload successfully get upload file information$info = $obj->getuploadfileinfo (); $pic = $info [0][' Savename ']; $pic = Explode ('/', $pic); $pic = $pic [0].'/'. $pic [1]; Print_r ($pic);EchoJson_encode (Array(' status '= 1,' msg '= $pic)); }}
Uploadfile,uploadimage class Http://pan.baidu.com/s/1i3IwhKh
ThinkPHP3.2.3 generating multiple thumbnail images