定制 dutchheight/aws-serverless-image-handler 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

dutchheight/aws-serverless-image-handler

最新稳定版本:1.1.3

Composer 安装命令:

composer require dutchheight/aws-serverless-image-handler

包简介

Craft CMS plugin to generate resource URL

README 文档

README

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. The following IAM Policy allow's craft to access your bucket:
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "s3:DeleteObject",
                "s3:GetObject",
                "s3:GetObjectAcl",
                "s3:GetBucketLocation",
                "s3:ListBucket",
                "s3:PutObject",
                "s3:PutObjectAcl"
            ],
            "Resource": [
                "arn:aws:s3:::bucket-name/*",
                "arn:aws:s3:::bucket-name"
            ]
        }
    ]
}
  1. 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 Note
width px value in number 1980px
height px value in number null Leave blank to keep ratio
fit cover, contain, fill, inside or outside cover
position top, right top, right, right bottom, bottom, left bottom, left or left top focalpoint
flip true, false false
flop true, false false
rotation Between 0 and 360 0
blur Between 0.5 and 1000 0
greyscale true, false false

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!

统计信息

  • 总下载量: 425
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 7
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 7
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2019-07-30

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固