endroid / image-placeholder
Endroid Image Placeholder
Fund package maintenance!
endroid
Installs: 2 285
Dependents: 0
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- ext-gd: *
- endroid/installer: ^1.2.2
Requires (Dev)
- endroid/quality: dev-main
- twig/twig: ^3.0
Suggests
- roave/security-advisories: Avoids installation of package versions with vulnerabilities
README
By endroid
Provides a Twig filter that replaces empty or invalid URLs with a placeholder image.
Installation
Use Composer to install the library.
$ composer require endroid/image-placeholder
Configuration
The default placeholder generation parameters can be overridden via the constructor arguments or service definition. All parameters are optional.
Usage
Placeholders are placed via a Twig filter that shows the placeholder image in case the service is activated and the given URL is empty or invalid.
<img src="{{ image_url|image_placeholder(200, 300) }}" /> <img src="{{ image_url|image_placeholder(200, 300, { check_image_exists: false }) }}" />
Versioning
Version numbers follow the MAJOR.MINOR.PATCH scheme. Backwards compatibility breaking changes will be kept to a minimum but be aware that these can occur. Lock your dependencies for production and test your code when upgrading.
License
This library is under the MIT license. For the full copyright and license information please view the LICENSE file that was distributed with this source code.