2
我无法让LiipImagineBundle识别流路径。它不是加载图像并应用指定的过滤器集,而是将流路径视为正常的网络路径。Symfony2:使用LiipImagineBundle和KnpGaufretteBundle以及Amazon S3中的树枝模板
这是我可以从各种来源拼凑起来的配置。我无法准确找到任何解决此问题的方法。就LiipImagineBundle而言,这些设置似乎没有取得任何成就。没有错误或警告,并且日志中没有任何内容。它完全忽略了我的配置。
#/src/Acme/StorageBundle/Resources/config/services.yml
services:
acme_storage.amazon_s3:
class: %acme_storage.amazon_s3.class%
arguments:
options:
key: %acme_storage.amazon_s3.aws_key%
secret: %acme_storage.amazon_s3.aws_secret_key%
certificate_authority: true
liip_imagine.binary.loader.stream.amazon_s3:
class: %liip_imagine.binary.loader.stream.class%
arguments:
- @liip_imagine
- 'gaufrette://amazon_s3/'
tags:
- name: liip_imagine.binary.loader
loader: stream.amazon_s3
liip_imagine.cache.resolver.amazon_s3:
class: Liip\ImagineBundle\Imagine\Cache\Resolver\AmazonS3Resolver
arguments:
- @acme_storage.amazon_s3
- %amazon_s3_bucket_name%
tags:
- name: liip_imagine.cache.resolver
resolver: cache.amazon_s3
# /app/config/config.yml
knp_gaufrette:
stream_wrapper:
protocol: gaufrette
filesystems:
amazon_s3: photo_storage
adapters:
photo_storage:
amazon_s3:
amazon_s3_id: beebop_storage.amazon_s3
bucket_name: %amazon_s3_bucket_name%
create: false
options:
create: true
region: %amazon_s3_region%
filesystems:
photo_storage:
adapter: photo_storage
alias: photo_storage_filesystem
liip_imagine:
cache: cache.amazon_s3
loaders:
stream.amazon_s3:
stream:
wrapper: gaufrette://amazon_s3
filter_sets:
cache: ~
event_small:
data_loader: stream.amazon_s3
quality: 75
filters:
thumbnail:
size: [60, 60]
mode: outbound
allow_upscale: true
嫩枝:
{{ 'gaufrette://amazon_s3/file.jpg'|imagine_filter('event_small') }}
产地:
http://example.com/media/cache/resolve/event_small/gaufrette://amazon_s3/file.jpg
不幸的是,在应用这些更改后,LiipImagineBundle的行为保持不变。它只是将我传递给'imagine_filter()'的任何东西都预取到它的本地缓存路径。 – turibe 2014-09-26 19:50:47
当您在浏览器上打开'http:// example.com/media/cache/resolve/event_small/file.jpg'时,是否出现错误?此路径应该将您重定向到缓存文件。 – lsouza 2014-09-27 01:54:20
是的,我得到一个500内部服务器错误:“给定的上下文不是有效的资源,”发生在'Liip \ ImagineBundle \ Binary \ Loader \ StreamLoader'中。我可以通过更深入地了解该位置正在发生的事情来弄清楚。 – turibe 2014-09-27 02:47:08