PHP code example of imsus / laravel-imgproxy

1. Go to this page and download the library: Download imsus/laravel-imgproxy 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/ */

    

imsus / laravel-imgproxy example snippets


return [
    'endpoint' => env('IMGPROXY_ENDPOINT', 'http://localhost:8080'),
    'key' => env('IMGPROXY_KEY'),
    'salt' => env('IMGPROXY_SALT'),
];

use Imsus\ImgProxy\Facades\ImgProxy;

// Generate URL using Facade
$url = ImgProxy::url('https://placehold.co/600x400/jpeg')
    ->setWidth(300)
    ->setHeight(200)
    ->build();

// Generate URL using helper function
$url = imgproxy('https://placehold.co/600x400/jpeg')
    ->setWidth(300)
    ->setHeight(200)
    ->build();
bash
php artisan vendor:publish --tag="imgproxy-config"
dotenv
IMGPROXY_ENDPOINT=http://localhost:8080
IMGPROXY_KEY=your_key_here
IMGPROXY_SALT=your_salt_here