I'm wondering how to wrap aws php sdk (aws/aws-sdk-php) within Symfony2 in order to use as cdn with SonataMediaBundle.
My current sonata confuguration:
sonata_media:
default_context: default
db_driver: doctrine_orm
contexts:
default:
providers:
- sonata.media.provider.image
formats:
default: { width: 100 , height: 100, quality: 70}
avatar:
providers:
- sonata.media.provider.image
formats:
medium: { width: 750 , quality: 90}
cdn:
server:
path: http://%s3_bucket_name%.s3-website-%s3_region%.amazonaws.com/%env%
providers:
image:
filesystem: sonata.media.filesystem.s3
service: sonata.media.provider.image
filesystem:
local:
directory: %kernel.root_dir%/../web/uploads/media
create: false
s3:
bucket: %s3_bucket_name%
accessKey: %s3_access_key%
secretKey: %s3_secret_key%
region: %s3_region%@
directory: %env%
But I receive an error: Attempted to load class "AmazonS3" from the global namespace
.
Apparently, playing with the config file is the right thing to do, in this case, we fixed our issue this way:
cdn:
server:
#path: http://%s3_bucket_name%.s3-website-%s3_region%.amazonaws.com/%env%
path: http://%s3_region%/%s3_bucket_name%/selfies/%env% # this one is working
With the following value for s3_region: s3_region: s3-eu-west-1.amazonaws.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With