dev-master
9999999-dev
MIT
The Requires
2.0
2.0.0.0
MIT
The Requires
2.0-RC.1
2.0.0.0-RC1
MIT
The Requires
1.2
1.2.0.0
MIT
The Requires
1.x-dev
1.9999999.9999999.9999999-dev
MIT
The Requires
1.1
1.1.0.0
MIT
The Requires
1.0
1.0.0.0
MIT
The Requires
Wallogit.com
2017 © Pedro Peláez
This bundle enables you to store your assets in S3 bucket instead of local filesystem, (*1)
composer require arsthanea/remote-media-bundle, (*2)
Add this bundle to your kernel after the KunstmaanMediaBundle:, (*3)
…
$bundles = [
//
new Kunstmaan\MediaBundle\KunstmaanMediaBundle(),
new ArsThanea\RemoteMediaBundle\RemoteMediaBundle(),
//
];
…
Setup S3 details in config.yml:, (*4)
remote_media:
cdn:
# The public URL to your bucket. You may use a CDN for instance
# If not sure leave null
#
media_url: https://a-cdn-for-my-bucket.cloudflare.net
# cached thumbnails can be stored in a prefixed path.
# the default value is the env name (i.e. "dev/") or no prefix on production
#
# cache_prefix: dev
# To speed up cache resolution, provide a doctrine_cache provider:
#
# cache_provider: liip_imagine
s3:
bucket: acme-bundle
# this is optional and defaults to eu-west-1
#
# region: eu-west-1
# please provide AWS access key and secret for this bucket:
#
access_key: %aws_access_key%
access_secret: %aws_access_secret%
You need to tweak the liip_imagine configuration a bit. Locate the default settings in config.yml or other place
and set the cache and data_provider keys to remote_media value:, (*5)
liip_imagine: cache: remote_media data_loader: remote_media
Use DoctrineCacheBundle (already used by Kunstmaan Bundles) to create a cache provider:, (*6)
doctrine_cache:
providers:
liip_imagine:
type: redis
Use media_url twig function to replace the media path with a CDN host. If you don’t need the CDN please keep in mind
that Media::getUrl() now returns a full URL instead of just a relative path., (*7)
<img src="{{ media_url(resource.image.url) }}">
MIT
MIT
MIT
MIT
MIT
MIT
MIT