@@ -10,44 +10,8 @@ class ImageUploadAndResize{
1010 protected $ isSubQuery = false ;
1111
1212 /**
13- * Database credentials
14- * @var string
15- */
16- protected $ host ;
17- protected $ username ;
18- protected $ password ;
19- protected $ db ;
20- protected $ port ;
21-
22- /**
23- * @param string $host
24- * @param string $username
25- * @param string $password
26- * @param string $db
27- * @param int $port
28- */
29-
30- public function __construct ($ host = null , $ username = null , $ password = null , $ db = null , $ port = null )
31- {
32- $ mysqli = new mysqli ($ host , $ username , $ password , $ db , $ port );
33- /*
34- * This is the "official" OO way to do it,
35- * BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
36- */
37- if ($ mysqli ->connect_error ) {
38- die ('Connect Error ( ' . $ mysqli ->connect_errno . ') '
39- . $ mysqli ->connect_error );
40- }
41- /*
42- * Use this instead of $connect_error if you need to ensure
43- * compatibility with PHP versions prior to 5.2.9 and 5.3.0.
44- */
45- if (mysqli_connect_error ()) {
46- die ('Connect Error ( ' . mysqli_connect_errno () . ') '
47- . mysqli_connect_error ());
48- }
49- $ mysqli ->close ();
50- }
13+ * Image compress and processing
14+ */
5115
5216 public function compressImage ($ sourceURL , $ destinationURL , $ minImgWidth , $ wmImageSource ="" , $ positionX ="" , $ positionY ="" , $ quality , $ newWidth ) {
5317 $ infoImg = getimagesize ($ sourceURL );
@@ -140,7 +104,7 @@ public function uploadFiles($yourFileName, $yourDestination, $minImgWidth=400, $
140104 $ path = trim ($ srcPath .$ fileName );
141105 if (self ::compressImage ($ _FILES [$ yourFileName ]['tmp_name ' ][$ this ->n ], $ path , $ minImgWidth , $ waterMarkImgSrc , $ xPosition , $ yPosition , $ quality , $ newWidth ))
142106 {
143- $ this ->prepareNames [] = array ( $ fileName) ; //need to be fixed.
107+ $ this ->prepareNames [] = $ fileName ; //need to be fixed.
144108 $ this ->Sflag = 1 ; // success
145109 }else {
146110 $ this ->Sflag = 2 ; // file not move to the destination
0 commit comments