Download the PHP package shel/neos-sqip without Composer

On this page you can find all versions of the php package shel/neos-sqip. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package neos-sqip

Shel.Neos.Sqip

Latest Stable Version Total Downloads License

Description

This package provides a fusion object for Neos CMS to render svg image placeholders based on the SQIP technique. They can be used to show a blurry or abstract version of an image while the real image is still lazy loading.

You can see it in action here.

Learn more about SQIP is a method to generate SVG based placeholders for images here:

Attention: the node.js based sqip is not released in version 1 yet. Therefore breaking changes might happen when you use the global binary and you might need to adjust the arguments in the settings or wait for an update of this package.

Installation

Requires npm (node.js) to work out of the box, although binaries can also be installed manually without it.

composer require shel/neos-sqip

Ensure the image manipulation library sqip is installed globally.

Alternatively install them using npm:

Globally

npm install -g sqip

Locally

npm install --prefix Packages/Plugins/Shel.Neos.Sqip/Resources/Private/Library

How to use

Use the provided fusion object Shel.Neos.Sqip:ImageTag to render an image with placeholder and use the lazy image loader layzr to lazy load the actual images. This object already provides the necessary attributes to make layzr work out of the box.

You can also use the provided Shel.Neos.Sqip:SqipImage fusion object to just render the SVG data which you can put into the src attribute of an img tag or in a inline style as background image.

The fusion object Shel.Neos.Sqip:SqipCaseRenderer provides a renderer for your src attribute which checks if the user is in the backend and then decides to render the original image uri instead of the SQIP image.

You can use this for example to modify the Carbon.Image:Tag object like this:

prototype(Carbon.Image:Tag) {
    attributes {
        src >
        src = Shel.Neos.Sqip:SqipCaseRenderer {
            asset = ${asset}
        }
        srcset >
        data-normal = Carbon.Image:ImageUri
        data-srcset = Carbon.Image:Srcset
    }
}

Compatible image formats

This package was tested with pngs, jpegs and svgs. Possibly other formats work well too.

Performance

Processing the SQIP placeholders is quite slow and takes several seconds per image.

To speed this up a thumbnail will be generated first (which can also be prerendered with CLI commands) to reduce the image dimensions. By default the preset from the Media Browser will be used which has dimensions of 250x250. So this is also a bit faster as the media module reuses the same thumbnails.

You can change the preset via configuration.

Configuration

Default options

Shel:
  Neos:
    Sqip:
      useGlobalBinary: false # use globally installed binaries
      globalBinaryPath: ''
      library: 'sqip'
      binaryPath: '.bin/sqip'
      arguments: "${'node ' + binaryPath + ' -n ' + numberOfPrimitives + ' -m ' + mode + ' -b ' + blur + ' ' + file}"
      parameters:
        # Customize the number of primitive SVG shapes (default=8) to influence bytesize or level of detail
        numberOfPrimitives: 8
        # Specify the type of primitive shapes that will be used to generate the image
        # 0=combo, 1=triangle, 2=rect, 3=ellipse, 4=circle, 5=rotatedrect, 6=beziers, 7=rotatedellipse, 8=polygon
        mode: 0
        # Set the gaussian blur
        blur: 12
      thumbnailPreset: 'Neos.Media.Browser:Thumbnail'

Using the go variant

The go version is faster than the node.js version and has less dependencies but currently doesn't provide the blur parameter. Both binaries have the same cli output and therefore work fine.

  1. Install the sqip binary like described in their instructions.
  2. Override the package settings in your own package like this:

    Shel:
      Neos:
        Sqip:
          useGlobalBinary: true
          globalBinaryPath: '/path/to/your/go/bin/' # Adapt this to your system
          arguments: "${binaryPath + ' -n ' + numberOfPrimitives + ' -mode ' + mode + ' ' + file}"
          parameters:
            # Customize the number of primitive SVG shapes (default=8) to influence bytesize or level of detail
            numberOfPrimitives: 8
            # Specify the type of primitive shapes that will be used to generate the image
            # 0=combo, 1=triangle, 2=rect, 3=ellipse, 4=circle, 5=rotatedrect, 6=beziers, 7=rotatedellipse, 8=polygon
            mode: 0

Caching

The generated SVGs will be cached in the filesystem as strings.

To speed the Cache up you can switch to use Redis like this in your Caches.yaml:

ShelNeosSqip_ImageCache:
  backend: Neos\Cache\Backend\RedisBackend
  backendOptions:
    database: 0

You can make the cache persistent to keep cached images when temporary caches are flushed:

ShelNeosSqip_ImageCache:
  persistent: true

All versions of neos-sqip with dependencies

PHP Build Version
Package Version
Requires neos/neos Version ~4.3 || ~5.0 || ~7.0 || ~8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package shel/neos-sqip contains the following files

Loading the files please wait ....