Media Watermark
Media watermark for Contensio - auto-apply text or image watermark to uploaded images with configurable position, opacity and scale.
About this plugin
Media Watermark
Automatically apply a text or image watermark to uploaded images.
Features
- Text watermark or image (PNG logo) watermark
- 9 position presets: 4 corners, 4 edge-midpoints, center, plus tiled
- Configurable opacity (0 to 100%)
- Configurable scale (watermark size as a percentage of the image width)
- Margin from the edges
- Skip small images (min-width and min-height thresholds)
- Whitelist of file extensions (jpg/jpeg, png, webp)
- Auto-apply on upload via the
contensio/media/uploadedhook action - Manual apply via artisan command for a single file or a whole directory
- Preview in the admin settings page shows a live example with your current settings
Requirements
- Contensio CMS
^2.0 - PHP 8.2+ with the GD extension (usually installed by default)
Installation
composer require contensio/plugin-watermark
Enable the plugin from the admin Plugins page.
Usage
Automatic on upload
The plugin listens to the contensio/media/uploaded action hook. Any core or plugin that fires this hook with the uploaded file path will trigger watermarking. The Contensio core fires this hook for every media upload.
Manual (artisan)
# Single file
php artisan contensio-watermark:apply storage/app/public/photo.jpg
# All images in a directory (recursive)
php artisan contensio-watermark:apply storage/app/public/uploads --recursive
From code
use Contensio\Watermark\Support\Watermark;
Watermark::apply('/absolute/path/to/image.jpg');
// Overwrites the image in place
Watermark::apply('/absolute/path/to/image.jpg', '/absolute/path/to/output.jpg');
// Writes to a different path
Notes
- The watermark is burned into the image. The original file is replaced unless you pass an output path. Keep backups before bulk-applying.
- WebP output requires PHP compiled with WebP support in GD (most modern PHP builds include it).
- PNG transparency is preserved when the image type is PNG.
License
AGPL-3.0-or-later. See the LICENSE file.