This extension serves as a replacement for the class CAssetManager. It publishes content on the Amazon AWS S3, allowing you to enable and use a CloudFront CDN for your assets.
To install just unzip into the protected folder . Warning! I used as a basis the extension ES3, so if you have it installed you may have name conflicts.
Basic configuration:
'components' = array( ...... 'cache'=>array( 'class'=>'system.caching.CMemCache', 'servers'=>array( array('host'=>'localhost', 'port'=>11211), ), ), 's3' => array( 'class' => 'ext.s3.ES3', 'aKey'=>'ADD YOUR AKEY HERE', 'sKey'=>'ADD YOUR SKEY HERE', ), 'assetManager' => array( 'class' => 'S3AssetManager', 'host' => 'Your-bucket.s3.amazonaws.com', // changing this you can point to your CloudFront hostname 'bucket' => 'Your-bucket', 'path' => 'assets', //or any other folder you want ), ...... )
Done! Your assets will be stored on Amazon!
Total 3 comments
For some reason Chrome requires the contentType to be 'text/css' to load properly, the asset manager uploads everything as 'text/plain'. Also, I kept having filename issue on uploading deep asset directories.
Here are my changes:
S3AssetManager.publish()
if (is_file($src))
AND
else if (is_dir($src))
Thank you Haykelbj!
Already correct and upload the extension.
I did not use the extension 'ES3' because it does not provide public access to all methods of S3 class (or at least I did not see how to access it).
Wow! I was about to implement this extension. Thanks!
I have just looked at the code on github and I noticed that the function S3AssetManager::getS3() is missing an if-statement:
missing line before 'throw':
One question: Is there a special reason why you did not use the 'es3' extension?
Thanks.
Leave a comment
Please login to leave your comment.