Download the PHP package imgix/imgix-php without Composer

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

imgix logo

imgix-php is a client library for generating image URLs with imgix. It is tested under PHP versions 8.0, 8.1 and 8.2.

Version Build Status Downloads License FOSSA Status


Installation

You can install the package via composer:

Usage

To begin creating imgix URLs programmatically, add the php files to your project. The URL builder can be reused to create URLs for any images on the domains it is provided.

HTTPS support is available by default. However, if you need HTTP support, call setUseHttps on the builder:

Signed URLs

To produce a signed URL, you must enable secure URLs on your source and then provide your signature key to the URL builder.

Srcset Generation

The imgix-php package allows for generation of custom srcset attributes, which can be invoked through the createSrcSet method. By default, the generated srcset will allow for responsive size switching by building a list of image-width mappings.

The above will produce the following srcset attribute value which can then be served to the client:

Fixed-Width Images

In cases where enough information is provided about an image's dimensions, createSrcSet will instead build a srcset that will allow for an image to be served at different resolutions. The parameters taken into consideration when determining if an image is fixed-width are w and h.

By invoking createSrcSet with either a width or height provided, a different srcset will be generated for a fixed-width image instead.

Will produce the following attribute value:

For more information to better understand srcset, we highly recommend Eric Portis' "Srcset and sizes" article which goes into depth about the subject.

Variable Quality

This library will automatically append a variable q parameter mapped to each dpr parameter when generating a fixed-width image srcset. This technique is commonly used to compensate for the increased file size of high-DPR images.

Since high-DPR images are displayed at a higher pixel density on devices, image quality can be lowered to reduce overall file size––without sacrificing perceived visual quality. For more information and examples of this technique in action, see this blog post.

This behavior will respect any overriding q value passed in as a parameter. Additionally, it can be disabled altogether by passing $disableVariableQuality = true to createSrcSet()'s $options.

This behavior specifically occurs when a fixed-width image is rendered, for example:

The above will generate a srcset with the following q to dpr query params:

Fluid-Width Images

Custom Widths

In situations where specific widths are desired when generating srcset pairs, a user can specify them by passing an array of positive integers as 'widths' within the $options array:

Note: in situations where a srcset is being rendered as a fixed-width srcset, any custom widths passed in will be ignored.

Additionally, if both widths and a width tolerance are passed to the createSrcSet method, the custom widths list will take precedence.

Width Ranges

In certain circumstances, you may want to limit the minimum or maximum value of the non-fixed srcset generated by the createSrcSet method. To do this, you can specify the widths at which a srcset should start and stop:

Formatted version of the above srcset attribute:

Width Tolerance

The srcset width tolerance dictates the maximum tolerated difference between an image's downloaded size and its rendered size.

For example, setting this value to 10 means that an image will not render more than 10% larger or smaller than its native size. In practice, the image URLs generated for a width-based srcset attribute will grow by twice this rate.

A lower tolerance means images will render closer to their native size (thereby increasing perceived image quality), but a large srcset list will be generated and consequently users may experience lower rates of cache-hit for pre-rendered images on your site.

By default, srcset width tolerance is set to 8 percent, which we consider to be the ideal rate for maximizing cache hits without sacrificing visual quality. Users can specify their own width tolerance by providing a positive scalar value as width tolerance:

In this case, the width tolerance is set to 20 percent, which will be reflected in the difference between subsequent widths in a srcset pair:

The ixlib Parameter

For security and diagnostic purposes, we sign all requests with the language and version of library used to generate the URL.

This can be disabled by setting setIncludeLibraryParam to False like so:

License

FOSSA Status


All versions of imgix-php with dependencies

PHP Build Version
Package Version
Requires php Version ^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 imgix/imgix-php contains the following files

Loading the files please wait ....