@@ -42,6 +42,17 @@ public function compressImage($sourceURL, $destinationURL, $minImgWidth, $wmImag
4242 // width to calculate positioning of the watermark.
4343 imagecopy ($ image , $ watermark , imagesx ($ image ) - $ sx - $ positionRight , imagesy ($ image ) - $ sy - $ positionBottom , 0 , 0 , imagesx ($ watermark ), imagesy ($ watermark ));
4444
45+ imagecopyresampled ($ imgResource , $ image , 0 , 0 , 0 , 0 , $ newWidth , $ newHeight , $ width , $ height );
46+ }elseif ($ infoImg ['mime ' ] == 'image/jpg ' ){
47+ $ image = imagecreatefromjpeg ($ sourceURL );
48+ // Set the margins for the watermark and get the height/width of the watermark image
49+ $ positionRight = $ positionX ;
50+ $ positionBottom = $ positionY ;
51+ $ sx = imagesx ($ watermark );
52+ $ sy = imagesy ($ watermark );
53+ // width to calculate positioning of the watermark.
54+ imagecopy ($ image , $ watermark , imagesx ($ image ) - $ sx - $ positionRight , imagesy ($ image ) - $ sy - $ positionBottom , 0 , 0 , imagesx ($ watermark ), imagesy ($ watermark ));
55+
4556 imagecopyresampled ($ imgResource , $ image , 0 , 0 , 0 , 0 , $ newWidth , $ newHeight , $ width , $ height );
4657 } elseif ($ infoImg ['mime ' ] == 'image/png ' ){
4758 $ image = imagecreatefrompng ($ sourceURL );
0 commit comments