Skip to content
Craft CMS plugin to generate resource URL
PHP
Branch: master
Clone or download
Latest commit fb6b465 Aug 13, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
resources/img Added icon & logo Jul 30, 2019
src check for subfolders Aug 13, 2019
.all-contributorsrc docs: create .all-contributorsrc Aug 13, 2019
.craftplugin first commit Jul 30, 2019
.gitignore first commit Jul 30, 2019
CHANGELOG.md Update CHANGELOG.md Aug 13, 2019
LICENSE.md License update Jul 30, 2019
README.md docs: update README.md Aug 13, 2019
composer.json Update composer.json Aug 13, 2019

README.md

Craft CMS AWS serverless image handler

All Contributors

Generates image handle from inside twig for AWS serverless image handler. More info Automatically detects client webp support.

Flow

Requirements

Installation

S3

  1. Install S3 volume plugin Use Craft AWS S3.

  2. Create a volume with the following settings:

    • Base URL is your cloudfront url (*.cloudfront.net)
    • Access Key ID is your IAM ID
    • Secret Access key is your IAM secret key
    • Bucket name is the name of your S3 bucket
    • Bucket region the region for exaple us-east-1
    • Make Uploads Public false
    • Focal point false

AWS serverless image handler

After setting up the S3 volume follow these instructions to install the plugin.

  1. Open your terminal and go to your Craft project:

     cd /path/to/project
    
  2. Then tell Composer to load the plugin:

     composer require dutchheight/aws-serverless-image-handler
    
  3. In the Control Panel, go to Settings → Plugins and click the “Install” button for AWS Serverless Image Handler.

  4. Add Toggle aws image processor to your s3 volume field layout.

Usage

In your twig template you can use:

{% set settings = {
    width: 2600,
    height: 450
} %}
    
{{ craft.awsserverlessimagehandler.getImgUrl(entry.slider.one(), settings) }}

This will generate the propper URL for the asset.

If you load the image with asset.url the original source will be served.

Availible settings

Properties Values Default
width px 800px
height px 400px
fit cover, contain, fill, inside or outside cover
position top, right top, right, right bottom, bottom, left bottom, left or left top focalpoint

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. Please make sure to update tests as appropriate.

Extra information

For more info about AWS serverless image handler and other ways to use AWS SIH with Craft CMS take a look at: Setting up your own image transform service

License

Craft

Contributors

Thanks goes to these wonderful people (emoji key):

Andrew Menich
Andrew Menich

💻

This project follows the all-contributors specification. Contributions of any kind welcome!

You can’t perform that action at this time.