Download the PHP package mhe/silverstripe-responsiveimages without Composer

On this page you can find all versions of the php package mhe/silverstripe-responsiveimages. 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 silverstripe-responsiveimages

SilverStripe Responsive Images

An module for SilverStripe that enhances the output of images with multiple resolutions as srcset attribute.

It tries to calculate the most appropriate resolutions for the given image and configuration.

During setup of the frontend output you will configure the basic rules about which output sizes an image will have (matching the layout setup done in CSS), the particular resolutions to generate will be handled by the module.

Calculation is based on the module mhe/imagetools – see there for more information.

Background

“Humans shouldn’t be doing this” – some inspiring thoughts on deciding which image resolutions make sense in responsive output can be found in this article by Jason Grigsby: Image Breakpoints, especially Setting image breakpoints based on a performance budget

Requirements

Requires Silverstripe 5.x – for a version compatible with Silverstripe 4 see respective branch 4

Installation and setup

Install with composer:

composer require mhe/silverstripe-responsiveimages ^1.0

Perform ?flush

Usage overview

The module activates an extension on Image objects and also provides an enhanced Shortcode provider. This means the result can be used in templates, programmatically on image output, and also on images placed into page content via the HTML editor.

There can be different configurations for different usages of images, like different layout context and desired visual sizes.

The main parameter which configuration is used for an image is the CSS class.

The configuration can consider a width set by the user, but as default the desired width is set solely by configuration to assure a consistant layout.

Configuration

General note: Image processing can be quite heavy on system performance, especially on memory usage. Once the desired images are generated they are cached by Silverstripe, but adding multiple new images, changing the configuration etc. can lead to problems, especially when first loading the appropriate page (Images are resized by Silverstripe on request, which usually means viewing a page).

In case of problems see the general advice below, and try to adjust the configuration options.

Output configurations

The setup is done in the Silverstripe YAML configuration API.

The configuration property Mhe\SmartImages\Extensions\ImageExtension.rendering_classes can contain multiple entries with the name of a CSS class as key.

The special entry default is used as a fallback for images without matching configuration – and also its properties are used as fallback for undefined properties of the other entries.

Properties

Also see the information in Imagetools documentation

Recommended general Silverstripe configuration

Don’t flush resized images, usually not necessary:

Using imagick backend if available is often much more performant and avoids memory issues:

Use in content

The image shortcodes created by the Silverstripe TinyMCE editor are handled by default. With a default setup you would setup configuration entries as described above, with the keys "left", "right", "center", "leftAlone", "rightAlone".

Use in templates

Output an image based on a specific configuration:

Rendering is done with a custom DBFile_image.ss template, which can be adjusted in a theme or application in the usual way.

Use in code

The same way can be used in PHP code to get an enhanced copy of an image object:


All versions of silverstripe-responsiveimages with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
ext-dom Version *
silverstripe/framework Version ^5.0
mhe/imagetools Version ^1.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 mhe/silverstripe-responsiveimages contains the following files

Loading the files please wait ....