The tests have a few external dependencies. To install those:
Just copy the files to your project, and include the
src/autoload.php file. We recommend using Composer if at all possible.
Define the following requirement in your
And include the global
To begin creating imgix URLs programmatically, simply add the php files to your project (an example autoloader is also provided). The URL builder can be reused to create URLs for any images on the domains it is provided.
For HTTPS support, simply use the setter
setUseHttps on the builder
To produce a signed URL, you must enable secure URLs on your source and then provide your signature key to the URL builder.
The imgix library allows for generation of custom
srcset attributes, which can be invoked through
createSrcSet(). By default, the
srcset generated will allow for responsive size switching by building a list of image-width mappings.
Will produce the following attribute value, which can then be served to the client:
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
ar. By invoking
createSrcSet() with either a width or the height and aspect ratio (along with
fit=crop, typically) provided, a different
srcset will be generated for a fixed-size 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.
More Core Libraries
- imgix-csharpbuildA C# client library for generating image URLs with imgixC# 12 2 months ago
- imgix-elixirbuildAn Elixir client library for generating image URLs with imgixElixir 29 a month ago
- imgix-gobuildA Go client library for generating image URLs with imgixGo 2 2 months ago
- imgix-javabuildA Java client library for generating URLs with imgixJava 13 3 months ago
- imgix-pythonbuildA Python client library for generating URLs with imgixPython 24 a month ago
- imgix-rbbuildA Ruby gem for generating image URLs with imgixRuby 63 2 months ago
- imgix-swiftbuildA Swift client library for generating URLs with imgixSwift 19 14 days ago