teepluss / attach
Laravel 4 Attachment
Requires
- php: >=5.3.0
- imagine/imagine: v0.6.1
Requires (Dev)
- illuminate/support: 4.1.x
This package is not auto-updated.
Last update: 2024-10-26 14:35:49 UTC
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