ivopetkov / lazy-image-bearframework-addon
Lazy image addon for Bear Framework
Installs: 2 474
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 0
Requires
- php: 7.1.*|7.2.*|7.3.*|7.4.*|8.0.*|8.1.*|8.2.*|8.3.*
- bearframework/bearframework: ^1.4
- ivopetkov/client-packages-bearframework-addon: 1.*
- ivopetkov/html-server-components-bearframework-addon: 1.*
- ivopetkov/responsively-lazy-bearframework-addon: 1.*
Requires (Dev)
- dev-master
- v2.6.0
- v2.5.0
- v2.4.0
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.1
- v2.0.0
- v1.8.0
- v1.7.2
- v1.7.1
- v1.7.0
- v1.6.0
- v1.5.1
- v1.5.0
- v1.4.2
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.0
- v1.1.1
- v1.0.1
- v1.0.0
- v0.2.14
- v0.2.13
- v0.2.12
- v0.2.11
- v0.2.10
- v0.2.9
- v0.2.8
- v0.2.7
- v0.2.6
- v0.2.5
- v0.2.4
- v0.2.3
- v0.2.2
- v0.2.1
- v0.2.0
- v0.2.0-beta.5
- v0.2.0-beta.4
- v0.2.0-beta.3
- v0.2.0-beta.2
- v0.2.0-beta.1
- v0.1.2
- v0.1.1
- v0.1.0
- v0.0.4
- v0.0.3
- v0.0.2
- v0.0.1
This package is auto-updated.
Last update: 2024-11-11 06:36:13 UTC
README
Addon for Bear Framework
This addon enables you to easily create lazy-loaded images that are SEO friendly. It's based on the popular library Responsively Lazy. Multiple versions with different sizes are created on the fly and only the best one is loaded. This saves bandwidth and loads the website faster.
Download and install
Install via Composer
composer require ivopetkov/lazy-image-bearframework-addon
Download an archive
Download the latest release from the GitHub page and include the autoload file.
include '/path/to/the/addon/autoload.php';
Enable the addon
Enable the addon for your Bear Framework application.
$app->addons->add('ivopetkov/lazy-image-bearframework-addon');
Usage
<component src="lazy-image" filename="path/to/the/file.jpg" />
Attributes
filename
The name of the file to be shown. It must be in a publicly accessible directory.
aspectRatio
The proportional relationship between the width and the height of the image. It is useful for cropping and resizing the image. Example values: 1:1, 1:2, 1.5:1, etc.
loadingBackground
The type of background shown while the image is loading. Available values: none and checkered.
class
HTML class attribute value
style
HTML style attribute value
alt
HTML alt attribute value
title
HTML title attribute value
Examples
The image rendered is a square
<component src="lazy-image" filename="path/to/the/file.jpg" aspectRatio="1:1" />
A custom class name is added to the image HTML code
<component src="lazy-image" filename="path/to/the/file.jpg" class="my-class-name" />
A title is added
<component src="lazy-image" filename="path/to/the/file.jpg" title="New Year's Eve" />
License
Lazy image addon for Bear Framework is open-sourced software. It's free to use under the MIT license. See the license file for more information.
Author
This addon is created by Ivo Petkov. Feel free to contact me at @IvoPetkovCom or ivopetkov.com.