1. Go to this page and download the library: Download rafiki23/watermarkcredits library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
rafiki23 / watermarkcredits example snippets
'providers' => [
// Other Service Providers
Rafiki23\WatermarkCredits\WatermarkServiceProvider::class,
],
return [
'opacity' => 0.6, // 60% opacity
'rectangle_color' => [0, 0, 0, 0.6], // black with 50% opacity
'text_color' => '#ffffff', // white
'font_size' => 24, // default font size
'font_path' => resource_path('fonts/Arial.ttf'), // path to the font file, assuming Arial.ttf is in the "fonts" folder under "resources"
'font_ratio' => 0.1, // font size as a ratio of image height
'default_logo_path' => resource_path('img/yourlogo.png'), // Default logo path, if you have a standard logo you want to use
];
use Rafiki23\WatermarkCredits\Watermark;
$watermark = new Watermark();
// Apply watermark to an image
$watermark->applyWatermark('path/to/image.jpg', 'Author name')->save('path/to/output/image.jpg');