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