Многократное watermark по картинке
Заказчик взговорил сделать наложение ватермарка по всей картинке, вот может кому-то сгодится:)
Хак простенький - заменить в файле:
/engine/classes/thumb.class.php
Строку:
imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
На код:
$num_x = floor($image_width / $watermark_width);
$num_y = floor($image_height / $watermark_height);
for($i = 0; $i <= $num_x;$i++) {
$watermark_x = $watermark_width * $i;
if($i != 0) imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
for($x = 0; $x <= $num_y;$x++) {
$watermark_y = $watermark_height * $x;
imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
}
}
/engine/classes/thumb.class.php
Строку:
imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
На код:
$num_x = floor($image_width / $watermark_width);
$num_y = floor($image_height / $watermark_height);
for($i = 0; $i <= $num_x;$i++) {
$watermark_x = $watermark_width * $i;
if($i != 0) imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
for($x = 0; $x <= $num_y;$x++) {
$watermark_y = $watermark_height * $x;
imagecopy( $this->img['src'], $watermark, $watermark_x, $watermark_y, 0, 0, $watermark_width, $watermark_height );
}
}