Download the PHP package vvv3/wp-responsive-images without Composer
On this page you can find all versions of the php package vvv3/wp-responsive-images. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vvv3/wp-responsive-images
More information about vvv3/wp-responsive-images
Files in vvv3/wp-responsive-images
Package wp-responsive-images
Short Description WordPress responsive images easily
License MIT
Homepage https://github.com/vvv3/wp-responsive-images#readme
Informations about the package wp-responsive-images
WP Responsive Images
A library for easy introduction of Responsive Images to WordPress site.
Requirements
Installation
Clone WP Responsive Images library or install with composer:
How to use
The library contains classes and helpers for easy introduction of Responsive Images to a WordPress site.
ImgUtils::resizeImg()
The \WPRI\ImgUtils::resizeImg method returns a link to the modified image according to the passed parameters.
Usage:
$url- URL to image file to resize$width- width value, integer$height- height value, integer$crop- bool flag crop or not
Returns:
string resized image url
Example:
ImgUtils::imgForPost, ImgUtils::pictureForPost
Helpers ImgUtils::imgForPost and ImgUtils::pictureForPost return a Responsive <img> or <picture> tag by post Id. You may set list of media
queries with image with for this query, double pixel ratio, aspect ratio for the images, loading="lazy" native attribute or any other additional attribute.
Usage:
ImgUtils::imgForPost(
int $postId,
array $mqWithWidth = [],
bool $pixelRatio2x = false,
int|float|null $aspectRatio = null,
bool $lazy = false,
array $attrs = [])
ImgUtils::pictureForPost(
int $postId,
array $mqWithWidth = [],
bool $pixelRatio2x = false,
int|float|null $aspectRatio = null,
bool $lazy = false,
array $attrs = [])
Returns:
string <img> or <picture> tag accordingly or empty string on error
Example:
ImgUtils::imgByAttachmentId, ImgUtils::pictureByAttachmentId
Helpers ImgUtils::imgByAttachmentId and ImgUtils::pictureByAttachmentId return a Responsive <img> , <picture> tag by attachment Id.