LiipImagine缓存不适用于FlySystem配置(S3)

时间:2019-06-17 10:13:10

标签: symfony amazon-s3 liipimaginebundle flysystem

我在用LiipImagineBundle https://symfony.com/doc/2.0/bundles/LiipImagineBundle/index.html创建缩略图时遇到问题。我可以在树枝上以全分辨率打印图像,但是如果添加Imagine滤镜,它将无法正常工作。

liip_imagine:

    loaders:
        flysystem_loader:
            flysystem:
                filesystem_service: oneup_flysystem.uploads_filesystem_filesystem
        # default loader to use for all filter sets

    resolvers:
        flysystem_resolver:
            flysystem:
                filesystem_service: oneup_flysystem.uploads_filesystem_filesystem
                cache_prefix: media/cache
                root_url: '%uploads_base_url%'

    data_loader: flysystem_loader

    cache: flysystem_resolver

    # valid drivers options include "gd" or "gmagick" or "imagick"
    driver: "gd"

    # define your filter sets under this option
    filter_sets:
        # an example thumbnail transformation definition
        # https://symfony.com/doc/current/bundles/LiipImagineBundle/basic-usage.html#create-thumbnails
        squared_thumbnail:
            jpeg_quality:          85
            png_compression_level: 8
            filters:
                auto_rotate: ~

                # strip the image of all metadata
                strip: ~
                thumbnail:
                    size:          [200, 200]
                    mode:          outbound
                    allow_upscale: true

        product_squared_photo:
            jpeg_quality:          85
            png_compression_level: 8
            filters:
                auto_rotate: ~
                strip: ~
                thumbnail:
                    size:          [540, 540]
                    mode:          outbound
                    allow_upscale: true
oneup_flysystem:
    adapters:
        uploads_adapter:
            awss3v3:
                client: Aws\S3\S3Client
                bucket: '%env(AWS_BUCKET_NAME)%'
    filesystems:
        uploads_filesystem:
            adapter: uploads_adapter

show.twig.html <img class="product__photo d-block w-100" src="{{ product.profileImage|imagine_filter('product_squared_photo') }}" alt="First slide"/>

product.profileImagefileName.fileExtension

和services.yaml

parameters:
#    cache_adapter: cache.adapter.apcu
    locale: 'en'
    uploads_base_url: 'https://%env(AWS_BUCKET_NAME)%.s3-eu-central-1.amazonaws.com'
#    uploads_base_url: '%kernel.project_dir%/public/uploads'

问题是AWS桶中不存在缓存目录,并且图像的URL是https://127.0.0.1:8000/media/cache/resolve/product_squared_photo/5d06fe3dce3e3.png,而不是AWS URL。看来我的配置不起作用。有什么想法吗?

0 个答案:

没有答案