quentinbuiteman / wordpress-responsive-images
Better implementation for responsive images for WordPress.
v2.0.0
2022-12-21 13:53 UTC
Requires
- php: >=7.1.0
- quentinbuiteman/easy-dom: ^1.1
- quentinbuiteman/wordpress-plugin-api: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-21 18:04:27 UTC
README
Better implementation for responsive images for WordPress.
WordPress generates responsive images based on set sizes. This doesn't take the upload size into consideration. This library will take the following steps when uploading an image:
- Generates an image at 3/4 of the size.
- Generates an image at 1/2 of the size.
- Generates an image at 1/4 of the size.
- Keeps the original thumbnail generated by WordPress.
- Inserted image will have the smallest size as it's src.
Installation
composer require quentinbuiteman/wordpress-responsive-images
Usage
Run the provided class, for example in your functions.php
.
use WordPressResponsive\Images;
$images = new Images();
You can also statically call the html generator, if you provide the ID of the image.
use WordPressResponsive\Images;
$html = Images::imgOutput($imageID);