PHP code example of flobbos / laravel-image-cache

1. Go to this page and download the library: Download flobbos/laravel-image-cache library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

flobbos / laravel-image-cache example snippets


use Flobbos\LaravelImageCache\Facades\ImageCache;

// Example: Apply the "small" template to an image
$cachedImage = ImageCache::template('path/to/image.jpg', 'small');

namespace App\ImageTemplates;

use Intervention\Image\Interfaces\ImageInterface;

class CustomTemplate
{
    public function build(ImageInterface $image)
    {
        $image->resize(800, 600);
    }
}

'templates' => [
    'custom' => \App\ImageTemplates\CustomTemplate::class,
],

use Flobbos\LaravelImageCache\Facades\ImageCache;

// Example: Apply the "small" template to an image
$cachedImage = ImageCache::template('path/to/image.jpg', 'small');

namespace App\ImageTemplates;

use Intervention\Image\Interfaces\ImageInterface;

class CustomTemplate
{
    public function build(ImageInterface $image)
    {
        $image->resize(800, 600);
    }
}

'templates' => [
    'custom' => \App\ImageTemplates\CustomTemplate::class,
],

use Flobbos\LaravelImageCache\Facades\ImageCache;

// Example: Apply the "small" template to an image
$cachedImage = ImageCache::template('path/to/image.jpg', 'small');

namespace App\ImageTemplates;

use Intervention\Image\Interfaces\ImageInterface;

class CustomTemplate
{
    public function build(ImageInterface $image)
    {
        $image->resize(800, 600);
    }
}

'templates' => [
    'custom' => \App\ImageTemplates\CustomTemplate::class,
],
bash
    php artisan vendor:publish --tag=config --provider="Flobbos\LaravelImageCache\ImageCacheServiceProvider"
    
bash
    php artisan vendor:publish --tag=config --provider="Flobbos\LaravelImageCache\ImageCacheServiceProvider"
    
bash
    php artisan vendor:publish --tag=config --provider="Flobbos\LaravelImageCache\ImageCacheServiceProvider"