From d7fef70c4c3707fd7650896c5a62f0a7c5cc81f0 Mon Sep 17 00:00:00 2001 From: modus75 Date: Thu, 15 Oct 2015 22:05:20 +0200 Subject: fix #361 - Watermark Y repeat --- i.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'i.php') diff --git a/i.php b/i.php index 0f242cf2d..3666eb5c5 100644 --- a/i.php +++ b/i.php @@ -575,17 +575,23 @@ if ($params->will_watermark($d_size)) if ($image->compose($wm_image, $x, $y, $wm->opacity)) { $changes++; - if ($wm->xrepeat) + if ($wm->xrepeat || $wm->yrepeat) { - // todo - $pad = $wm_size[0] + max(30, round($wm_size[0]/4)); + $xpad = $wm_size[0] + max(30, round($wm_size[0]/4)); + $ypad = $wm_size[1] + max(30, round($wm_size[1]/4)); + for($i=-$wm->xrepeat; $i<=$wm->xrepeat; $i++) { - if (!$i) continue; - $x2 = $x + $i * $pad; - if ($x2>=0 && $x2+$wm_size[0]<$d_size[0]) - if (!$image->compose($wm_image, $x2, $y, $wm->opacity)) - break; + for($j=-$wm->yrepeat; $j<=$wm->yrepeat; $j++) + { + if (!$i && !$j) continue; + $x2 = $x + $i * $xpad; + $y2 = $y + $j * $ypad; + if ($x2>=0 && $x2+$wm_size[0]<$d_size[0] && + $y2>=0 && $y2+$wm_size[1]<$d_size[1] ) + if (!$image->compose($wm_image, $x2, $y2, $wm->opacity)) + break; + } } } } -- cgit v1.2.3