1

如果我将LiipImagineBundle配置为使用流数据加载器,那么如何制作图像标签以在模板中使用该数据加载器?

更新配置

knp_gaufrette:
adapters:
    image_storage:
        amazon_s3:
            amazon_s3_id: namespace_admin.amazon_s3
            bucket_name:  %amazon_s3_bucket_name%
            create:       false
            options:
                create:     true
                directory: 'mydir'
                region:     %amazon_s3_region%


filesystems:
    image_storage:
        adapter:    image_storage
        alias:      image_storage_filesystem

    s3_storage:
        adapter:    image_storage

stream_wrapper:
        protocol: data
        filesystems:
            - s3_storage



namespace_admin:
    amazon_s3:
        aws_key:        %amazon_aws_key%
        aws_secret_key: %amazon_aws_secret_key%
        aws_region:     %amazon_s3_region%
        base_url:       %amazon_s3_base_url%

liip_imagine:
    loaders:
        stream.my_namespace_images:
            stream:
                wrapper: data://s3_storage

resolvers:
   default:
      web_path: ~

filter_sets:
    cache: ~
    gi_thumb:
        data_loader: stream.my_namespace_images
        quality: 75
        filters:
            thumbnail: { size: [120, 90], mode: outbound }
4

1 回答 1

0

有两件事,你需要做。

  1. 过滤器gi_thumb需要设置data_loaderstream.get_inspired_images.
  2. 在您的模板中,您只需在imagine_filter可由该加载器加载的文件路径上调用:{{ '/example/path/image.png'|imagine_filter('gi_thumb', true) }}

这将加载此图像:http://your-bucket.s3.amazonaws.com/example/path/image.png.

于 2014-04-28T06:24:53.083 回答