2017 © Pedro Peláez
 

library someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

image

someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  • Thursday, May 24, 2018
  • by libern
  • Repository
  • 1 Watchers
  • 3 Stars
  • 3,522 Installations
  • PHP
  • 4 Dependents
  • 0 Suggesters
  • 4 Forks
  • 0 Open issues
  • 31 Versions
  • 5 % Grown

The README.md

Someline Image Service

Latest Version Software License Total Downloads, (*1)

Someline Image is a helper service to handle uploaded images and store images without duplicates., (*2)

Build for Laravel and Someline Starter., (*3)

Install

Via Composer

Install composer package to your laravel project, (*4)

``` bash composer require someline/someline-image, (*5)


Add Service Provider to `config/app.php` ``` php 'providers' => [ ... Someline\Image\SomelineImageServiceProvider::class, ... ],

Publishing config file., (*6)

``` bash php artisan vendor:publish, (*7)


After published, config file for Rest Client is `config/someline-image.php`, you will need to config it to use Rest Client. ## Usage #### Routes ``` php Route::get('/image/{name}', 'ImageController@showOriginalImage'); Route::post('/image', 'ImageController@postImage');

Many Imageables

Use on the Model:, (*8)

    use SomelineHasImageablesTrait;

Usage:, (*9)

``` php, (*10)

/** @var SomelineImage $somelineImage */ $somelineImage = SomelineImage::find(1);, (*11)

/** @var User $user */ $user = User::find(1);, (*12)

// save image relations smartly with sequence support (recommended) $user->syncImages([1, 2], ['type' => 'cover', 'data' => json_encode('a')]);, (*13)

// save image relations via save $user->images()->save($somelineImage, ['type' => 'cover', 'data' => json_encode('a')]);, (*14)

// save image relations via attach $user->images()->attach(1, ['type' => 'cover', 'data' => json_encode('a')]);, (*15)

// update image relations via sync $user->images()->sync([1]);, (*16)

// set as main image $user->setAsMainImage($somelineImage);, (*17)

// set as type main image $user->setAsTypeMainImage('cover', $somelineImage);, (*18)

// get all images print_r($user->getImages()->toArray());, (*19)

// get first main image print_r($user->getMainImage()->toArray());, (*20)

// get all main images print_r($user->getMainImages()->toArray());, (*21)

// get all type images print_r($user->getTypeImages('cover')->toArray());, (*22)

// get all type images and are main images print_r($user->getTypeMainImages('cover')->toArray());, (*23)


#### Sample Controller File `app/Http/Controllers/ImageController.php` ``` php <?php namespace App\Http\Controllers; use Exception; use Illuminate\Http\Request; use Someline\Image\Controllers\SomelineImageController; use Someline\Models\Image\SomelineImage; use Someline\Image\SomelineImageService; class ImageController extends Controller { public function postImage(Request $request) { $somelineImageService = new SomelineImageService(); $file = $request->file('image'); $somelineImage = null; try { /** @var SomelineImage $somelineImage */ $somelineImage = $somelineImageService->handleUploadedFile($file); } catch (Exception $e) { return 'Failed to save: ' . $e->getMessage(); } if (!$somelineImage) { return 'Failed to save uploaded image.'; } $somelineImageId = $somelineImage->getSomelineImageId(); return 'Saved: ' . $somelineImage->getImageUrl(); } public function showOriginalImage($image_name) { return SomelineImageController::showImage('original', $image_name); } }

Testing

bash phpunit, (*24)

Contributing

Please see CONTRIBUTING for details., (*25)

Credits

License

The MIT License (MIT). Please see License File for more information., (*26)

The Versions

24/05 2018

dev-master

9999999-dev https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

24/05 2018

v2.3.2

2.3.2.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

24/05 2018

v2.3.1

2.3.1.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

20/04 2018

v2.2.4

2.2.4.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

27/10 2017

v2.2.3

2.2.3.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

27/10 2017

v2.2.2

2.2.2.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

01/09 2017

v2.2.1

2.2.1.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

17/07 2017

v2.1.1

2.1.1.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

16/06 2017

v2.0.11

2.0.11.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

02/06 2017

v2.0.10

2.0.10.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

02/06 2017

v2.0.9

2.0.9.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

02/06 2017

v2.0.8

2.0.8.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

01/06 2017

v2.0.7

2.0.7.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

01/06 2017

v2.0.6

2.0.6.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

18/05 2017

v2.0.5

2.0.5.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

17/05 2017

v2.0.4

2.0.4.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

10/05 2017

v2.0.3

2.0.3.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

09/05 2017

v2.0.2

2.0.2.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

11/03 2017

v2.0.1

2.0.1.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

11/03 2017

v2.0.0

2.0.0.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

10/03 2017

v1.0.9

1.0.9.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

10/03 2017

v1.1.0

1.1.0.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

10/03 2017

v1.0.8

1.0.8.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

06/03 2017

v1.0.7

1.0.7.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

10/02 2017

v1.0.6

1.0.6.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

09/02 2017

v1.0.5

1.0.5.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

08/02 2017

v1.0.4

1.0.4.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

26/01 2017

v1.0.3

1.0.3.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

23/01 2017

v1.0.2

1.0.2.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

27/09 2016

v1.0.1

1.0.1.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image

27/09 2016

v1.0.0

1.0.0.0 https://github.com/someline/someline-image

Someline Image is a helper service to handle uploaded images and store images without duplicates.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel service image someline-starter starter-framework someline-image