michaeldojcar/laravel-photo

Laravel photo module

v0.2.3 2021-03-22 15:54 UTC

README

Latest Stable Version Total Downloads Latest Unstable Version License

Simple photo module which you can use to upload and work with photos in your project.

It provides Photo model controlled using Services\PhotoService class.

Photos are stored in Laravel public storage and their metadata in database (table photos).

Install

php artisan vendor:publish --provider=MichaelDojcar\LaravelPhoto\Providers\PhotoServiceProvider

Access photo

Get photo public url:

use MichaelDojcar\LaravelPhoto\Models\Photo;

$photo = Photo::findOrFail(1);
$photo->url();

Get resized photo URL

You can generate any size of your Photos immediately in blade template.

use MichaelDojcar\LaravelPhoto\Models\Photo;

$photo = Photo::findOrFail(1);
$photo->resize(250, 120); // Specify width and height