2017 © Pedro Peláez
 

neos-package neos-responsiveimages

Neos package that helps implementing responsive images based on npm's lazyimages

image

visol/neos-responsiveimages

Neos package that helps implementing responsive images based on npm's lazyimages

  • Friday, March 9, 2018
  • by visol
  • Repository
  • 4 Watchers
  • 3 Stars
  • 112 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 14 % Grown

The README.md

Visol.Neos.ResponsiveImages

This Neos package helps using npm's lazysizes strategy to implement responsive images. See https://www.npmjs.com/package/lazysizes, (*1)

Installation

To install the package correctly, go to your theme package (e.g. Packages/Sites/Visol.Site) and run the following command:, (*2)

composer require visol/neos-responsiveimages --no-update, (*3)

  • Install lazysizes. E.g. with npm, (*4)

    npm install lazysizes --save
    
  • Add the JavaScript sources to your main script, (*5)

    import 'lazysizes/plugins/parent-fit/ls.parent-fit.min';
    import 'lazysizes/plugins/bgset/ls.bgset.min';
    import 'lazysizes/lazysizes.min';
    

Quick Start

Just replace usages of the Neos.Fusion:Image prototype with Visol.Neos.ResponsiveImages:ImageTag. e.g., (*6)

image = Visol.Neos.ResponsiveImages:ImageTag {
    asset = ${q(event).property('teaserImage')}
    ratio = 1.46
}

Or use the ViewHelper provided. e.g., (*7)

{namespace responsiveImages=Visol\Neos\ResponsiveImages\ViewHelpers}

<responsiveImages:image image="{item.properties.sliderImage}" ratio="1.89583" />

Configuration

Adjust the desired image sizes in your Settings.yaml, (*8)

Visol:
  Neos:
    ResponsiveImages:
      SizesPresets:
        Default:
          - 16
          - 48
          - 96
          - 160
          - 320
          - 480
          - 640
          - 960
          - 1024
          - 1440
          - 1920
          - 2560
          - 3840
          - 5120

Usage with background images

Use Visol.Neos.ResponsiveImages:SrcSet prototype to generate srcset-Attribute, (*9)

imageUri = Visol.Neos.ResponsiveImages:SrcSet {
    asset = ${q(offer).property('image')}
    ratio = 0.91
}

Add class lazyload and data-attributes, (*10)

<div class="lazyload" data-bgset={props.imageUri} data-sizes="auto">

Compatibility and Maintenance

This package is currently being maintained for the following versions:, (*11)

Neos Version Version Maintained
Neos 3.x 1.x Yes
Neos 4.x 1.x Yes
Neos 5.x and above 2.x Yes

Credits

https://www.npmjs.com/package/lazysizes, (*12)

visol digitale Dienstleistungen GmbH, www.visol.ch, (*13)

The Versions

09/03 2018

dev-master

9999999-dev

Neos package that helps implementing responsive images based on npm's lazyimages

  Sources   Download

MIT

The Requires

 

09/03 2018

0.1.2

0.1.2.0

Neos package that helps implementing responsive images based on npm's lazyimages

  Sources   Download

MIT

The Requires

 

09/03 2018

0.1.1

0.1.1.0

Neos package that helps implementing responsive images based on npm's lazyimages

  Sources   Download

MIT

The Requires

 

28/02 2018

0.1.0

0.1.0.0

Neos package that helps implementing responsive images based on npm's lazyimages

  Sources   Download

MIT

The Requires

 

28/02 2018

0.0.2

0.0.2.0

Neos package that helps implementing responsive images based on npm's lazyimages

  Sources   Download

MIT

The Requires

 

28/02 2018

0.0.1

0.0.1.0

Neos package that helps implementing responsive images based on npm's lazyimages

  Sources   Download

MIT

The Requires