Commit bb13d9f6 authored by osman's avatar osman

Updated module description and documentation.

parent 8f036ac6
This is a simple Drupal module to lazy-load all inline images and/or iframes
defined by content authors in entity content, usually the text-format-enabled
version of textarea fields. i.e. Node and Block body content.
[Lazy-load][1] is a simple Drupal module which integrates [bLazy][2]
lazy-loading script via image field *display formatters* and *input-filters* for
inline images and iframes.
The module currently depends on the [bLazy][1] image script.
There is another contributed module utilizing its namesake, [Blazy][3]. Make
sure to check it out, especially if you need more advanced features and support
for many features out of the box.
There is another contributed module utilizing its namesake, [Blazy][2].
Make sure to check it out, especially if you need more advanced features and
support for many features out of the box.
This module started to fill-in the only area Blazy module lacks of;
**inline-images** and **inline-iframes**. Now, Lazy-load can also be enabled for
each image field as well.
This module focuses on the only area Blazy module lacks of; **inline-images**
and **inline-iframes**.
You can still use this module tandem with it, though that is not a requirement.
You can use [Lazy-load][1] module tandem with [Blazy][3], though that is not a
requirement.
## Requirements
* **[Libraries API][4]** module
* **bLazy v1.8.2** script as a library item:
[Download bLazy][3] from https://github.com/dinbror/blazy
1) Extract the downloaded file,
2) rename *blazy-master* directory to *blazy*,
3) copy the folder into one of the following places that *Libraries API*
* **[Libraries API][5]** module (Drupal 7 only)
* **bLazy v1.8.2** script as a library item
## Installing Manually
- [Download bLazy][4] from https://github.com/dinbror/blazy
- Extract the downloaded file,
- rename *blazy-master* directory to *blazy*,
- copy the folder into one of the following places that *Libraries API*
module supports, `sites/all/libraries` (or site-specific libraries folder):
i.e.: `sites/all/libraries/blazy/blazy.min.js`
## Installation
Install the module as usual. More information can be found at
https://www.drupal.org/docs/7/extend/installing-modules
## Installing via Composer
- Run `composer require --prefer-dist composer/installers` to ensure that you
have the `composer/installers` package installed. This package facilitates the
installation of packages into directories other than `/vendor`
(e.g. `/libraries`) using Composer.
- If your `composer.json` doesn’t already have a definition for the libraries
path, define one similar to the one below, depending on your setup:
``` json
"extra": {
"installer-paths": {
"web/sites/all/libraries/{$name}": ["type:drupal-library"]
}
}
```
- Add following to the “repositories” section of `composer.json`:
``` json
"repositories": [
{
"type": "package",
"package": {
"name": "dinbror/blazy",
"version": "1.8.2",
"type": "drupal-library",
"extra": {
"installer-name": "blazy"
},
"source": {
"type": "git",
"url": "https://github.com/dinbror/blazy",
"reference": "1.8.2"
}
}
},
]
```
- Install the required **Blazy** library:
`composer require 'dinbror/blazy:1.8.2'`
- Install this module:
`composer require 'drupal/lazy:^1.0'`
## Usage
This modules makes a new text filter available for the text-formats: *Lazy-load*
Lazy-loading can be enabled for both
1. **Image fields** via display formatters
2. Inline images and iframes in the content via **input filters** in text-formats.
### Image Fields
Change the desired image-field's display setting from `Image` to
`Lazy-load image` to enable lazy-loading for the selected field. When the
formatting option changed between `Image` and `Lazy-load image` formatters
_image style_ and _link image to_ settings should remain unchanged.
### Input Filters
Enable `Lazy-load images and IFRAMEs via bLazy` filter in desired text-formats
(`admin/config/content/formats`). i.e. *Full HTML*
The images and iframes defined in the formatted-text fields automatically
enables them to be lazy-loaded.
To disable lazy-loading for specific image or iframes, add **skip-class** to the
class attribute. Default value (no-b-lazy) can be changed in the configuration.
``` html
<img class="no-b-lazy" src="this-image-will-load-normal" alt="">
```
Enable the *Lazy-load* filter for the desired text-formats. i.e. *Full HTML* or
*Filtered HTML*
### Configuration
Check out the module configuration at `admin/config/content/lazy`. The default
settings should work for most developers. Incase they are not, change the
settings to suit your needs and submit the form.
Check out the module configuration at `admin/config/content/lazy` for further
customization. Though, the default settings should work for most developers.
This configuration is used globally for all the text-formats having *Lazy-load*
filter enabled.
Remember, the same configuration is used for both image fields and input-filters.
## Use Case
......@@ -59,7 +127,8 @@ rewrites the `<img>` and/or `<iframe>` tags in already rendered output to have
them compatible for bLazy script to lazy-load. Since the filtered output is
cached, there should not be any changes in performance.
[1]: http://dinbror.dk/blazy/
[2]: https://www.drupal.org/project/blazy
[3]: https://github.com/dinbror/blazy/archive/master.zip
[4]: https://www.drupal.org/project/libraries
[1]: https://www.drupal.org/project/lazy
[2]: http://dinbror.dk/blazy/
[3]: https://www.drupal.org/project/blazy
[4]: https://github.com/dinbror/blazy/archive/master.zip
[5]: https://www.drupal.org/project/libraries
name = Lazy-load
description = "This module integrates bLazy script to lazy load inline images and/or iframes via input-filters."
description = "This module integrates bLazy script via image field display formatters and input-filters for inline images and iframes."
core = 7.x
dependencies[] = drupal:filter
dependencies[] = libraries
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment