Sylius:如何配置KnpGaufrette将图像上传到AWS S3?

时间:2019-07-08 14:15:22

标签: symfony amazon-s3 sylius liipimaginebundle gaufrette

我正在尝试配置 Sylius ,以便将图像上传到 AWS S3 。 Sylius在引擎盖下使用 LiipImageBundle ,所以我遵循他们的Docs进行了所有设置。

但是,在此配置之后,什么也没有发生。当我在后端提交图像时,它似乎无处发送。没有错误消息记录。在应用程序日志文件中也不会出现任何一行。 当我删除这些设置(或至少删除行cache: artist_photos)时,一切工作都像在将图像写入./web/media/cache之前一样。

这是我的配置:

config.yml:

parameters:
    locale: en_US
    amazon.s3.key:     "yyyyyy"
    amazon.s3.secret:  "xxxxxxxxx"
    amazon.s3.bucket:  "test.xxxxxx.com"
    amazon.s3.region:  "eu-central-1"
    amazon.s3.version: "2006-03-01"



liip_imagine:
    resolvers:
        default:
            web_path:
                web_root: "%kernel.project_dir%/web"
                cache_prefix: "media/cache"


        artist_photos:
            aws_s3:
                client_config:
                    credentials:
                        key:    "%amazon.s3.key%"
                        secret: "%amazon.s3.secret%"
                    region: "%amazon.s3.region%"
                    version: "%amazon.s3.version%"
                bucket: "%amazon.s3.bucket%"
                get_options:
                    Scheme: https
                put_options:
                    CacheControl: "max-age=86400"

    cache: artist_photos

    filter_sets:
        cache: ~
        my_thumb:
            cache: artist_photos
            filters:
            # the filter list

services.yml:

app.amazon_s3:
    class: Aws\S3\S3Client
    factory: [Aws\S3\S3Client, factory]
    arguments:
        -
            credentials: { key: "%amazon.s3.key%", secret: "%amazon.s3.secret%" }
            region: "%amazon.s3.region%"
            version: "%amazon.s3.version%"

app.imagine.cache.resolver.amazon_s3:
    class: Liip\ImagineBundle\Imagine\Cache\Resolver\AwsS3Resolver
    arguments:
        - "@app.amazon_s3"
        - "%amazon.s3.bucket%"
    tags:
        - { name: "liip_imagine.cache.resolver", resolver: "amazon_s3" }

我在这里想念什么?

0 个答案:

没有答案