Created
November 9, 2021 13:52
-
-
Save zoparga/a3a9b579bc65155d13c65222fe6f10cc to your computer and use it in GitHub Desktop.
Place multiple watermark on picture with a 45 degree
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$divided_by = 4; | |
$watermark_text = "watermark text"; | |
for ($i = 0; $i < $image_resize->getWidth(); $i = $i+($image_resize->getWidth()/$divided_by)) { | |
for ($j = 0; $j < $image_resize->getHeight(); $j = $j+($image_resize->getHeight()/$divided_by)) { | |
$image_resize->text($watermark_text, $i, $j, function ($font) use ($image_resize) { | |
$font->file(storage_path('fonts/DejaVuSans.ttf')); | |
$font->size(($image_resize->getHeight()/70)); | |
$font->color(array(0, 0, 0, 0.2)); | |
$font->align('center'); | |
$font->valign('bottom'); | |
$font->angle(45); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment