当尝试使用LiipImagineBundle + VichUploaderBundle和Amazon S3时,我遇到了一个奇怪的问题。
当我通过symfony表单(使用VichFileType表单字段)上传文件时,该文件已在Amazon S3上成功创建(通过Gaufrette)。
当我在树枝视图中显示上载的文件时,它会完美显示。
但是,当我尝试生成文件的缩略图(已上传到S3)时,出现以下错误:
服务“ liip_imagine.cache.resolver.amazon_s3”具有不存在的服务“ 1”的依赖关系。
我已经按照文档进行操作:https://symfony.com/doc/2.0/bundles/LiipImagineBundle/cache-resolver/aws_s3.html
这是我的app/config/config.yml
文件:
# VichUploaderBundle Configuration
vich_uploader:
db_driver: orm
twig: true
storage: gaufrette
mappings:
campaign_image:
uri_prefix: "%aws_base_url%/%aws_bucket_name%/uploads/campaigns"
upload_destination: campaign_image_fs
namer: vich_uploader.namer_uniqid
delete_on_remove: true
delete_on_update: true
inject_on_load: true
user_identity:
uri_prefix: "%aws_base_url%/%aws_bucket_name%/uploads/users"
upload_destination: user_identity_fs
namer: vich_uploader.namer_uniqid
delete_on_remove: true
delete_on_update: true
inject_on_load: true
# LiipImagineBundle Configuration
liip_imagine:
driver: imagick
cache: amazon_s3
resolvers:
amazon_s3:
aws_s3:
client_config:
credentials:
key: "%aws_bucket_key%"
secret: "%aws_bucket_secret%"
region: "%aws_bucket_region%"
bucket: "%aws_bucket_name%"
version: "2006-03-01"
bucket: "%aws_bucket_name%"
cache: true
get_options:
Scheme: https
put_options:
CacheControl: "max-age=86400"
filter_sets:
cache: ~
800x600:
quality : 93
filters:
auto_rotate: ~
strip: ~
scale:
dim: [ 500, 800 ]
# KnpGaufretteBundle Configuration
knp_gaufrette:
stream_wrapper: ~
adapters:
user_identity_adapter:
aws_s3:
service_id: 'app.manager.amazon_s3'
bucket_name: '%aws_bucket_name%'
detect_content_type: true
options:
create: true
directory: uploads/users
campaign_image_adapter:
aws_s3:
service_id: 'app.manager.amazon_s3'
bucket_name: '%aws_bucket_name%'
detect_content_type: true
options:
create: true
directory: uploads/campaigns
filesystems:
user_identity_fs:
adapter: user_identity_adapter
campaign_image_fs:
adapter: campaign_image_adapter
这是我的app / config / services.yml文件:
app.manager.amazon_s3:
class: Aws\S3\S3Client
factory_class: Aws\S3\S3Client
factory_method: 'factory'
arguments:
-
version: "2006-03-01"
region: "%aws_bucket_region%"
credentials: { "key": "%aws_bucket_key%", "secret": "%aws_bucket_secret%" }
app.imagine.cache.resolver.amazon_s3:
class: Liip\ImagineBundle\Imagine\Cache\Resolver\AwsS3Resolver
arguments:
- "@app.manager.amazon_s3"
- "%aws_bucket_name%"
- "public-read" # Aws\S3\Enum\CannedAcl::PUBLIC_READ (default)
- { Scheme: https }
- { CacheControl: "max-age=86400" }
calls:
- [ setGetOption, [ Scheme, https ] ]
- [ setPutOption, [ CacheControl, "max-age=86400" ] ]
tags:
- { name: "liip_imagine.cache.resolver", resolver: "amazon_s3"}
为什么我无法使其正常工作?
任何帮助表示赞赏!
谢谢