yaroslawww/laravel-lorem-image

Generates a configured preview image.

2.0.0 2022-10-05 07:08 UTC

This package is auto-updated.

Last update: 2024-11-05 12:05:28 UTC


README

Packagist License Build Status Code Coverage Scrutinizer Code Quality

Generates a configured preview image.

Installation

Install the package via composer:

composer require yaroslawww/laravel-lorem-image
# Or only for development purposes
composer require yaroslawww/laravel-lorem-image --dev

Optionally you can publish the config file with:

php artisan vendor:publish --provider="Limsum\ServiceProvider" --tag="config"

If you need to use color-block driver, then please add routes to web.php

\Limsum\Facades\Limsum::routes();

Usage

\Limsum::url();
// or
\Limsum\Facades\Limsum::size(274, 200)->svg()->url();
\Limsum\Facades\Limsum::driver('color-block')->size(274, 200)->svg()->url();
\Limsum\Facades\Limsum::url([
    'width' => 274,
    'height' => 200
]);
\Limsum\Facades\Limsum::url('thumbnail');
\Limsum\Facades\Limsum::driver('lorem-picsum')->size(274, 200)->random()->url()

Example image for development purpose with lazy loading. (Lazy loading not includes in package)

<img class="lazy"
    src="{{ \Limsum\Facades\Limsum::size(274, 200)->svg()->url() }}"
    data-src="{{ \Limsum\Facades\Limsum::driver('lorem-picsum')->size(274, 200)->random()->url() }}"
>

Credits