2017 © Pedro Peláez
 

library up2

UP2 is a file uploader with polymorphic relations.

image

teepluss/up2

UP2 is a file uploader with polymorphic relations.

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 4 Forks
  • 2 Open issues
  • 11 Versions
  • 0 % Grown

The README.md

Uploader Manager for Laravel

For Laravel 4, please use the v1.x branch!

UP2 is a file uploader with polymorphic relations., (*1)

Installation

To get the lastest version of Theme simply require it in your composer.json file., (*2)

"teepluss/up2": "dev-master"

You'll then need to run composer install to download it and have the autoloader updated., (*3)

Once Theme is installed you need to register the service provider with the application. Open up app/config/app.php and find the providers key., (*4)

'providers' => [

    Teepluss\Up2\Up2ServiceProvider::class

]

UP2 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., (*5)

'aliases' => [

    'UP2' => Teepluss\Up2\Facades\Up2::class

]

Publish using artisan CLI., (*6)

php artisan vendor:publish --provider="Teepluss\Up2\Up2ServiceProvider"

Migrate tables., (*7)

php artisan migrate

Usage

The uploader configuration is located at app/config/up2.php. In this file you may specify which uploader driver you would like used by default throughout your application. UP2 supports Local and S3., (*8)

'drivers' => array(

    'local' => array(
        'baseUrl' => url(''),
        'baseDir' => path_public(),
    ),

    's3' => array(
        'key'    => '',
        'secret' => '',
        'region' => 'ap-southeast-1',
        'bucket' => 'teeplus',
    ),

),

Then you have to create a morph method for your model that want to use "UP2"., (*9)

use Teepluss\Up2\Up2Trait;
use Illuminate\Database\Eloquent\Model;

class Blog extends Model {

    use Up2Trait;

    public function .....

}

Now you able to use "UP2" for uploading file.

Upload file and resizing., (*10)

// Return an original file meta.
UP2::upload(Blog::find(1), Input::file('userfile'))->getMasterResult();
UP2::upload(User::find(1), Input::file('userfile'))->getMasterResult();

// Return all results files uploaded including resized.
UP2::upload(Product::find(1), Input::file('userfile'))->resize()->getResults();

// If you have other fields in table attachments.
UP2::upload(User::find(1), Input::file('userfile'), array('some_id' => 999))->getMasterResult();

// UP2 can upload remote file.
UP2::inject(array('remote' => true))->upload(User::find(1), 'http://domain.com/image.png', array('some_id' => 999))->getResults();

Upload without model., (*11)

UP2::upload(null, Input::file('userfile'))->getMasterResult();

Inject configuration., (*12)

UP2::inject(array('subpath' => 'uploads/products'))->upload(Blog::find(1), Input::file('userfile'))->getMasterResult();

Look up a file path., (*13)

$blogs = Blog::with('attachments')->get();

foreach ($blogs as $blog)
{
    foreach ($blog->attachments as $attachment)
    {
        echo UP2::lookup($attachment->id);

        // or lookup with scale from config.
        echo UP2::lookup($attachment->id)->scale('l');
    }
}

Remove file(s) from storage., (*14)

$attachmentId = 'b5540d7e6350589004e02e23feb3dc1f';

// Remove a single file.
UP2::remove($attachmentId);

// Remove all files including resized.
UP2::remove($attachmentId, true);

Support or Contact

If you have some problem, Please contact teepluss@gmail.com, (*15)

Support via PayPal, (*16)

The Versions

02/12 2016

v1.x-dev

1.9999999.9999999.9999999-dev https://github.com/teepluss/laravel4-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload laravel4 resize

02/09 2016

dev-master

9999999-dev https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

02/09 2016

3.0.1

3.0.1.0 https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

02/09 2016

2.1.3

2.1.3.0 https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

28/07 2016

3.0.0

3.0.0.0 https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

27/07 2016

2.1.2

2.1.2.0 https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

22/12 2015

2.1.0

2.1.0.0 https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

28/10 2015

2.0.0

2.0.0.0 https://github.com/teepluss/laravel-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload resize

22/10 2015

1.0.2

1.0.2.0 https://github.com/teepluss/laravel4-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload laravel4 resize

12/03 2015

1.0.1

1.0.1.0 https://github.com/teepluss/laravel4-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload laravel4 resize

11/03 2015

1.0.0

1.0.0.0 https://github.com/teepluss/laravel4-up2

UP2 is a file uploader with polymorphic relations.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel upload laravel4 resize