limit0 / assets-bundle
为使用limit0/assets的项目实现图像上传支持
v1.0
2017-03-07 18:01 UTC
Requires
- php: >=5.4
- as3/modlr-bundle: dev-master
- limit0/assets: ~1.0
- symfony/framework-bundle: >=2.0 <2.7 || ^3.0
- symfony/yaml: >=2.0 <2.7 || ^3.0
This package is not auto-updated.
Last update: 2024-09-15 01:57:35 UTC
README
为使用limit0/assets的项目实现图像上传支持
要求
- 您需要一个AWS账户,并能够访问S3存储桶,或者
- 您需要通过您的Web服务器用户对本地存储路径具有写入权限。
安装
通过composer安装此包
composer require limit0/assets-bundle
在您的AppKernel.php中包含此bundle
public function registerBundles() { $bundles = [ // ... new Limit0\AssetsBundle\Limit0AssetsBundle(), // ...
配置
使用您首选的资产存储提供商配置此bundle。完整的可能配置如下所示
limit0_assets: engine: aws_s3 # Either `aws_s3` or `local_storage` http_prefix: //my-cdn.io/path-to-images/ # A URL prefix for your uploaded images. Can be relative. # The URL provided by the uploader will prefix the filename with this path, so they can be viewed. aws_s3: region: us-east-1 # Default S3 storage region acl: public-read # Default ACL for uploaded files bucket: mybucket # Bucket to upload files to local_storage: path: /uploads/myproject # Path on server to upload files to. Can be relative.
如果使用AWS S3,则需要bucket。如果使用本地存储,则需要path。
路由
您需要导入此bundle的路由。为了防止任何潜在的冲突问题,确保在加载其他应用程序路由之前加载它
limit0_assets: resource: "@Limit0AssetsBundle/Resources/config/routing.yml" prefix: / app_bundle: resource: "@AppBundle/Resources/config/routing.yml" # ...