Package Data | |
---|---|
Maintainer Username: | teepluss |
Maintainer Contact: | admin@laravel.in.th (Teepluss) |
Package Create Date: | 2013-05-16 |
Package Last Update: | 2016-07-08 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-05 03:03:05 |
Package Statistics | |
---|---|
Total Downloads: | 203 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 14 |
Total Watchers: | 2 |
Total Forks: | 1 |
Total Open Issues: | 0 |
Attach is a file uploader for Laravel version 4.
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
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();
If you have some problem, Contact teepluss@gmail.com