THINKPHP3.0 after uploading a file thumbnails can not be saved to subdirectories, because UploadFile.class.php this upload class Getsubname () function can only create subdirectories of the original image and not create a thumbnail of the sub-directory, can be said to be a bug.
Solution One (thinkphp officially provided, I have not tested): Upgrade to ThinkPHP3.1 the latest UploadFile.class.php (https://github.com/liu21st/extend/tree/ master/extend/library/org/net), replace the original UploadFile.class.php after downloading
Workaround two: Modify part of the code for UploadFile.class.php
This is your own solution, add a thumbnail of the sub-directory generation function
Step 1>>
Create a Getthumbsubname () function in UploadFile.class.php by imitating the getsubname () function
| |
copy code |
| Private function Getthumbsubname ($file) { Switch ($this->subtype) { case ' date ': $dir = Date ($this->dateformat,time ()); break; Case ' hash ': Default: $name = MD5 ($this->thumbpath); $dir = "; for ($i =0; $i < $this->hashlevel; $i + +) { $dir. = $name {$i}. ' /'; } Break; if (!is_dir ($this->thumbpath). $dir) { mkdir ($this->thumbpath). $dir); } return $dir; } |
Step 2>>
UploadFile.class.php in line 158 instead
| The code is as follows |
Copy Code |
$thumbPath = $this->thumbpath? $this->thumbpath. ($this->autosub? $this->getthumbsubname ($file). ' /': '): $file [' Savepath ']; |
http://www.bkjia.com/PHPjc/632175.html www.bkjia.com true http://www.bkjia.com/PHPjc/632175.html techarticle THINKPHP3.0 After uploading a file thumbnails can not be saved to subdirectories, because UploadFile.class.php this upload class Getsubname () function can only create subdirectories of the original image and not create a thumbnail ...