Tools for working with Imgix in Craft
- Download & unzip the file and place the
oneimgix
directory into yourcraft/plugins
directory - -OR- install with Composer via
composer require onedesign/oneimgix
- Install plugin in the Craft Control Panel under Settings > Plugins
- The plugin folder should be named
oneimgix
for Craft to see it. GitHub recently started appending-master
(the branch name) to the name of the folder for zip file downloads. - Update the settings for the plugin as explained below.
OneImgix expects the following settings to be configured:
- Imgix API Key: Your Imgix API key, obtained from the Imgix control panel.
- Imgix Source Name: The name of your source defined in the Imgix control panel.
- Secure URL Token: If you have
Secure URL
enabled for your Imgix source, this should be theSecure URL Token
value listed there. - Asset Base URL: The base path to your original assets, which will be replaced with the Imgix base URL by this plugin. This will typically be something like
http://mysite.com/assets/
orhttps://s3.amazonaws.com/my-bucket-name/
{% set url = craft.oneImgix.url(myAssetField.first, {
w: 1000,
h: 800,
q: 50,
auto: 'format',
fit: 'max'
}) %}
Any options supported by the Imgix image API can be passed into these options. OneImgix will do the work of transforming the original asset URL into the appropriate Imgix URL based on your plugin settings.
Whenever an asset in Craft is replaced or deleted, OneImgix will attempt to automatically clear the corresponding Imgix cache for that asset.