ThinkPHP3.2.3 generating multiple thumbnail images

Source: Internet
Author: User
Tags save file

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.