freshleafmedia / glide-dimension-watermark
A Glide manipulation which overlays the images dimensions onto an image.
Installs: 1 671
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: >7.1
- league/glide: ^2.0
This package is auto-updated.
Last update: 2025-03-29 01:16:04 UTC
README
Automatically add text to an image showing the dimensions.
Overview
It is common when using placeholder images to show the images dimensions in the center of the image. This library is a Glide manipulator which will do this and automatically adjust text size.
Photo by Robert Bye on Unsplash
Installation
composer require freshleafmedia/glide-dimension-watermark
Usage
use Freshleafmedia\DimensionWatermark\DimensionWatermark; // Setup Glide server. See https://glide.thephpleague.com/2.0/simple-example/ $server = League\Glide\ServerFactory::create([ // ... ]); // Add DimensionWatermark to the manipulators array $manipulators = $server->getApi()->getManipulators(); array_splice($manipulators, count($manipulators) - 1, 0, [new DimensionWatermark()]); $server->getApi()->setManipulators($manipulators);
The manipulator runs when the dwm
parameter is set to any value. For example /image.jpg?dwm=1
or /image.jpg?w=100&fm=webp&dwm=1
Note: It is important that DimensionWatermark
is added after the Size
manipulator and before Encode
manipulator
License
See LICENSE