Download the PHP package newism/craft-imgix without Composer
On this page you can find all versions of the php package newism/craft-imgix. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package craft-imgix
Imgix Asset Transformer for Craft CMS
Adds imgix powered asset transforms to Craft CMS:
- Drop-in replacement for Craft CMS native image transforms and .srcset() method
- Add additional imgix parameters to image transforms
- Use imgix for CP thumbnails
- Allows
.pdf
files to be rasterized and transformed (unlike Craft CMS transforms)
The only thing you'll need to update is your filesystem Base URL to use your imgix domain.
Requirements
This plugin requires Craft CMS 4.0.0 or later, and PHP 8.0.2 or later.
See Caveats for additional requirements.
Installation
You can install this plugin with Composer.
Then update your filesystem Base URL to use your imgix domain.
Configuration
Copy config.php into Crafts config folder and rename it to newism-imgix.php.
Update the imgixDomain
settings key with your imgix domain.
twig {# Set the transform #} {% do asset.setTransform({ ratio: 16/9, }) %}
{# Render the tag #} {{ tag('img', { src: asset.url, width: asset.width, height: asset.height, srcset: asset.getSrcset(['1.5x', '2x', '3x']), alt: asset.title, }) }} twig {# Set the transform #} {% do asset.setTransform({ width: 300, height: 300, imgix: { blur: 20, }, }) %}
{# Render the tag #} {{ tag('img', { src: asset.url, width: asset.width, height: asset.height, srcset: asset.getSrcset(['1.5x', '2x', '3x']), alt: asset.title, }) }}
### Caveats
#### .svg
imgix does not support rasterizing .svg inputs by default ([blog post](https://www.imgix.com/blog/announcing-support-for-webp-and-svg)).
You will need to contact imgix to enable this feature. This plugin does add transform query parameters to .svg files regardless of this setting.
#### .pdf
.pdf file are served with `rasterize-bypass` set to true when no transform is provided. This will serve the original .pdf file.
> The `rasterize-bypass` parameter allows users to bypass all rendering parameters, including default parameters, and serve the original image file. This is particularly useful for file formats that support vector graphics and do not require rasterization. [Source](https://docs.imgix.com/en-US/apis/rendering/format/rasterize-bypass)
#### `imgix` object key values
In Craft CMS < v5.6.0 the additional `imgix` object key values are lost
when calling [.srcset()](https://craftcms.com/docs/5.x/development/image-transforms.html#generating-srcset-sizes).