WebP for Thumbnails
Automate the creation and deletion of WebP versions of thumbnails
This package enhances the process of image uploads and thumbnail generation without altering the core functionality, focusing primarily on the use of WebP image format for efficiency. It automates the creation and deletion of WebP versions of thumbnails to ensure lighter images are displayed across various screen sizes without requiring user intervention. The package does not support the upload of WebP images directly but instead focuses on presenting WebP versions of existing thumbnails.
Features
- Installs five
ThumbnailTypes
matching default Bootstrap breakpoints for comprehensive display options. - Introduces listeners for
ThumbnailGenerate
andThumbnailDelete
events to manage WebP versions, ensuring they are created upon thumbnail generation and removed upon deletion. - Includes a template for the "Image" block named "Webp", facilitating the use of WebP images in the frontend.
- Provides a job for recreating all WebP thumbnails, addressing the issue of existing thumbnails not having WebP versions until this job is executed.
- Supports the use of
LemonbrainWebp\ImageBrewer
in custom development scenarios, offering methods likeImageBrewer::get()
for generating `` elements with WebP and original format sources, andImageBrewer::getJson()
for JSON responses including image URLs. - The
ImageBrewer::get()
function allows for customization of image display using parameters such asfileID
,altText
,ratio
,objectFit
,misc
, andclasses
, enhancing flexibility in image presentation. - The JSON response function,
ImageBrewer::getJson()
, optionally includes the content of the main image, useful for SVG images, and outputs URLs only for existing files, ensuring relevance and efficiency.
This package simplifies the integration of WebP images into a project, providing automatic handling and customization options without the need for extensive user knowledge of WebP formats, thus optimizing image size and quality across different devices.