Download the PHP package mostlyserious/craft-imgix-picture without Composer

On this page you can find all versions of the php package mostlyserious/craft-imgix-picture. 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 craft-imgix-picture

imgix Picture

A Twig helper to generate picture tags from a set of imgix transforms.

Requirements

This plugin requires Craft CMS 4.9.0 or later, and PHP 8.0.2 or later.

Installation

You can install this plugin with Composer.

With Composer

Open your terminal and run the following commands:

Configuration

This plugin assumes that you have one Asset Volume and File System configured (Typically an Amazon S3 bucket) an an imgix source that references that File System. Note: multiple imgix sources are not supported at this time.

To get started, create an imgix account with a source and an API Key.

The API key requires Purge permissions, and it is used only to purge assets on Craft's Asset events, such as replace.

Add your imgix url and API key as environment variables in your .env file.

Add then add this config file at config/imgix-picture:

Usage

Use the picture function to generate a <picture> tag from an Asset.

The picture() function

This function is called with 3 arguments:

  1. The first argument must be a Craft Asset object.
  2. The second is an array of transforms.

    • a non-standard breakpoint property is a min-width pixel value that adds a min-width media query to <source> elements inside the picture, ex: media="(min-width: 1024px)".
    • Focal Point parameters are added automatically if the Asset has a focal point.
    • Transforms may contain any parameter in the imgix Rendering API. Recommended default attributes are set by the plugin as a baseline, but will be overidden with any you provide here.

    • If only one transform is passed in, an <img> tag will be rendered instead of a picture tag.
  3. The third parameter is an object representing html attributes you wish to add to the rendered element. Images are lazy loading by default, but you can override this, for example:

Other Functions


All versions of craft-imgix-picture with dependencies

PHP Build Version
Package Version
Requires php Version >=8.0.2
craftcms/cms Version ^3.9.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 mostlyserious/craft-imgix-picture contains the following files

Loading the files please wait ....