fix #361 - Watermark Y repeat
This commit is contained in:
parent
11ccdff585
commit
d7fef70c4c
6 changed files with 28 additions and 9 deletions
|
@ -578,7 +578,7 @@ switch ($page['section'])
|
|||
$position = 'bottomright';
|
||||
}
|
||||
|
||||
if ($wm->xrepeat != 0)
|
||||
if ($wm->xrepeat != 0 || $wm->yrepeat != 0)
|
||||
{
|
||||
$position = 'custom';
|
||||
}
|
||||
|
@ -592,6 +592,7 @@ switch ($page['section'])
|
|||
'xpos' => $wm->xpos,
|
||||
'ypos' => $wm->ypos,
|
||||
'xrepeat' => $wm->xrepeat,
|
||||
'yrepeat' => $wm->yrepeat,
|
||||
'opacity' => $wm->opacity,
|
||||
'position' => $position,
|
||||
)
|
||||
|
|
|
@ -126,6 +126,7 @@ if (count($errors) == 0)
|
|||
$watermark->xpos = intval($pwatermark['xpos']);
|
||||
$watermark->ypos = intval($pwatermark['ypos']);
|
||||
$watermark->xrepeat = intval($pwatermark['xrepeat']);
|
||||
$watermark->yrepeat = intval($pwatermark['yrepeat']);
|
||||
$watermark->opacity = intval($pwatermark['opacity']);
|
||||
$watermark->min_size = array(intval($pwatermark['minw']),intval($pwatermark['minh']));
|
||||
|
||||
|
@ -135,6 +136,7 @@ if (count($errors) == 0)
|
|||
|| $watermark->xpos != $old_watermark->xpos
|
||||
|| $watermark->ypos != $old_watermark->ypos
|
||||
|| $watermark->xrepeat != $old_watermark->xrepeat
|
||||
|| $watermark->yrepeat != $old_watermark->yrepeat
|
||||
|| $watermark->opacity != $old_watermark->opacity;
|
||||
|
||||
// save the new watermark configuration
|
||||
|
|
|
@ -111,6 +111,13 @@
|
|||
<input size="3" maxlength="3" type="text" name="w[xrepeat]" value="{$watermark.xrepeat}"{if isset($ferrors.watermark.xrepeat)} class="dError"{/if}>
|
||||
{if isset($ferrors.watermark.xrepeat)}<span class="dErrorDesc" title="{$ferrors.watermark.xrepeat}">!</span>{/if}
|
||||
</label>
|
||||
|
||||
<br>
|
||||
<label>{'Y Repeat'|translate}
|
||||
<input size="3" maxlength="3" type="text" name="w[yrepeat]" value="{$watermark.yrepeat}"{if isset($ferrors.watermark.yrepeat)} class="dError"{/if}>
|
||||
{if isset($ferrors.watermark.yrepeat)}<span class="dErrorDesc" title="{$ferrors.watermark.yrepeat}">!</span>{/if}
|
||||
</label>
|
||||
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
|
22
i.php
22
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,6 +52,8 @@ final class WatermarkParams
|
|||
/** @var int */
|
||||
public $xrepeat = 0;
|
||||
/** @var int */
|
||||
public $yrepeat = 0;
|
||||
/** @var int */
|
||||
public $opacity = 100;
|
||||
}
|
||||
|
||||
|
|
|
@ -931,6 +931,7 @@ $lang['wrong filename'] = "wrong filename";
|
|||
$lang['X Position'] = 'X Position';
|
||||
$lang['X Repeat'] = 'X Repeat';
|
||||
$lang['Y Position'] = 'Y Position';
|
||||
$lang['Y Repeat'] = 'Y Repeat';
|
||||
$lang['Year'] = "Year";
|
||||
$lang['You are running on development sources, no check possible.'] = "You are running on development sources, no check possible.";
|
||||
$lang['You are running the latest version of Piwigo.'] = "You are running Piwigo latest version.";
|
||||
|
|
Loading…
Add table
Reference in a new issue