teepluss/attach

Laravel 4 Attachment
204 14
Install
composer require teepluss/attach
Latest Version:v0.2
PHP:>=5.3.0
License:MIT
Last Updated:Jul 8, 2016
Links: GitHub  ·  Packagist
Maintainer: teepluss

File upload with resized.

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

Support via PayPal

Related Packages

teepluss/up2

UP2 is a file uploader with polymorphic relations.

730 12
teepluss/up

UP is a file uploader with polymorphic relations.

284 20
teepluss/cloudinary

Cloudinary API wrapper for Laravel 4

10,525 18
oval/laravel-upload-helper

Upload helper library for Laravel

550 3
codesleeve/laravel-stapler

Easy file upload management for the Laravel Framework.

415,323 556