@@ -442,7 +442,6 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
442
442
$ this ->_getCallback ('create ' , $ watermarkFileType , 'Unsupported watermark image format. ' ),
443
443
$ imagePath
444
444
);
445
- //$watermark = $this->prepareWatermark($watermark, $watermarkFileType);
446
445
447
446
$ merged = false ;
448
447
@@ -600,49 +599,6 @@ public function watermark($imagePath, $positionX = 0, $positionY = 0, $opacity =
600
599
$ this ->refreshImageDimensions ();
601
600
}
602
601
603
- /**
604
- * @param resource $watermark
605
- * @param string $watermarkFileType
606
- * @return resource
607
- */
608
- private function prepareWatermark ($ watermark , $ watermarkFileType )
609
- {
610
- if (imagesx ($ watermark ) > $ this ->_imageSrcWidth
611
- || imagesy ($ watermark ) > $ this ->_imageSrcHeight ) {
612
- $ widthRatio = imagesx ($ watermark )/$ this ->_imageSrcWidth ;
613
- $ heightRatio = imagesy ($ watermark )/$ this ->_imageSrcHeight ;
614
- $ newWidth = ($ widthRatio > $ heightRatio )
615
- ? round (imagesx ($ watermark )/$ widthRatio ) : round (imagesx ($ watermark )/$ heightRatio );
616
- $ newHeight = ($ widthRatio > $ heightRatio )
617
- ? round (imagesy ($ watermark )/$ widthRatio ) : round (imagesy ($ watermark )/$ heightRatio );
618
- $ isAlpha = false ;
619
- $ isTrueColor = false ;
620
- $ this ->_getTransparency ($ watermark , $ watermarkFileType , $ isAlpha , $ isTrueColor );
621
- if ($ isTrueColor ) {
622
- $ newImage = imagecreatetruecolor ($ newWidth , $ newHeight );
623
- } else {
624
- $ newImage = imagecreate ($ newWidth , $ newHeight );
625
- }
626
- if ($ isAlpha ) {
627
- $ this ->_saveAlpha ($ newImage );
628
- }
629
- imagecopyresampled (
630
- $ newImage ,
631
- $ watermark ,
632
- 0 ,
633
- 0 ,
634
- 0 ,
635
- 0 ,
636
- $ newWidth ,
637
- $ newHeight ,
638
- imagesx ($ watermark ),
639
- imagesy ($ watermark )
640
- );
641
- $ watermark = $ newImage ;
642
- }
643
- return $ watermark ;
644
- }
645
-
646
602
/**
647
603
* Crop image
648
604
*
@@ -866,8 +822,9 @@ protected function _createEmptyImage($width, $height)
866
822
* @param int $src_w
867
823
* @param int $src_h
868
824
* @param int $pct
869
- *
870
825
* @return bool
826
+ * @SuppressWarnings(PHPMD.CyclomaticComplexity)
827
+ * @SuppressWarnings(PHPMD.NPathComplexity)
871
828
*/
872
829
private function imagecopymergeWithAlphaFix (
873
830
$ dst_im ,
0 commit comments