@@ -94,8 +94,11 @@ public function createDir($folderName, $permission){
94
94
}
95
95
96
96
97
- public function uploadFiles ($ yourFileName , $ yourDestination , $ minImgWidth =400 , $ waterMarkImgSrc ="" , $ xPosition ="" , $ yPosition ="" , $ reName ="" , $ permission =0655 , $ quality =100 , $ newWidth ="" ){
97
+ public function uploadFiles ($ yourFileName , $ yourDestination , $ createThumb = false , $ minImgWidth =400 , $ waterMarkImgSrc ="" , $ xPosition ="" , $ yPosition ="" , $ reName ="" , $ permission =0655 , $ quality =100 , $ newWidth= "" , $ thumbWidth ="" ){
98
98
if (!empty ($ _FILES [$ yourFileName ])){
99
+ if ($ createThumb !="" and $ createThumb ===true ){
100
+ $ srcThumbPath = self ::createDir ($ yourDestination .'/thumb ' , $ permission ).'/ ' ;
101
+ }
99
102
foreach ($ _FILES [$ yourFileName ]['name ' ] as $ val )
100
103
{
101
104
$ infoExt = getimagesize ($ _FILES [$ yourFileName ]['tmp_name ' ][$ this ->n ]);
@@ -112,9 +115,12 @@ public function uploadFiles($yourFileName, $yourDestination, $minImgWidth=400, $
112
115
}else {
113
116
$ fileName = $ files [0 ].$ File_Ext ;
114
117
}
115
- $ path = trim ($ srcPath .$ fileName );
116
- if (self ::compressImage ($ _FILES [$ yourFileName ]['tmp_name ' ][$ this ->n ], $ path , $ minImgWidth , $ waterMarkImgSrc , $ xPosition , $ yPosition , $ quality , $ newWidth ))
117
- {
118
+ $ path = trim ($ srcPath .$ fileName );
119
+ $ thumbPath = trim ($ srcThumbPath .$ fileName );
120
+ if (self ::compressImage ($ _FILES [$ yourFileName ]['tmp_name ' ][$ this ->n ], $ path , $ minImgWidth , $ waterMarkImgSrc , $ xPosition , $ yPosition , $ quality , $ newWidth )){
121
+
122
+ self ::compressImage ($ _FILES [$ yourFileName ]['tmp_name ' ][$ this ->n ], $ thumbPath , $ minImgWidth , $ waterMarkImgSrc , $ xPosition , $ yPosition , $ quality , $ thumbWidth );
123
+
118
124
$ this ->prepareNames [] = $ fileName ; //need to be fixed.
119
125
$ this ->Sflag = 1 ; // success
120
126
}else {
0 commit comments