Skip to content

Instantly share code, notes, and snippets.

@rslhdyt
Last active September 22, 2017 13:14
Show Gist options
  • Save rslhdyt/6f920ab19ad9f5fbf304bcb12d4f5290 to your computer and use it in GitHub Desktop.
Save rslhdyt/6f920ab19ad9f5fbf304bcb12d4f5290 to your computer and use it in GitHub Desktop.
[Intervention Image] Apply multiple watermark to image
<?php
// .....
$img = Image::make('images/picture.jpg');
$watermark = Image::make('images/watermark.png');
$x = 0;
while ($x < $img->width()) {
$y = 0;
while($y < $img->height()) {
$img->insert('images/watermark.png', 'top-left', $x, $y);
$y += $watermark->height();
}
$x += $watermark->width();
}
$img->save(public_path('storage/' . $thumbnailFile), 60);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment