teepluss/attach
Composer 安装命令:
composer require teepluss/attach
包简介
Laravel 4 Attachment
README 文档
README
Attach is a file uploader for Laravel version 4.
Installation
To get the lastest version of Theme simply require it in your composer.json file.
"teepluss/attach": "dev-master"
You'll then need to run composer install to download it and have the autoloader updated.
Once Attach is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key.
'providers' => array(
'Teepluss\Attach\AttachServiceProvider'
)
Attach also ships with a facade which provides the static syntax for creating collections. You can register the facade in the aliases key of your app/config/app.php file.
'aliases' => array(
'Attach' => 'Teepluss\Attach\Facades\Attach'
)
Publish config using artisan CLI.
php artisan config:publish teepluss/attach
Usage
Basic upload
$attach = Attach::inject(array( 'subpath' => 'tee' )) ->add(Input::file('userfile')) ->upload(); var_dump($attach->onComplete());
Remote upload
$attach = Attach::inject(array( 'remote' => true )) ->add('http://...../file.png') ->upload();
Resizing
$attach = Attach::open('/path/to/image.png')->resize(); // To specific scales from config. $attach = Attach::open('/path/to/image.png')->resize(array('l', 'm'));
Upload and Resize
$attach = Attach::add(Input::file('userfile'))->upload()->resize();
Remove
$attach = Attach::open($path)->remove();
You can inject your config anytime
$attach = Attach::inject(array( ..... YOUR CONFIG ..... )) ->upload();
Callback
Attach::inject(array( 'onUpload' => function($result) { // }, 'onComplete' => function($results) { // }, 'onRemove' => function($result) { // } )) ->upload() ->resize();
Support or Contact
If you have some problem, Contact teepluss@gmail.com
统计信息
- 总下载量: 204
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-05-17