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
imgproxy('https://example.com/image.jpg')
->setWidth(800)
->setHeight(600)
->setResizeType(ResizeType::FILL)
->setExtension(OutputExtension::WEBP)
->setQuality(85)
->setBlur(2.0)
->setSharpen(1.0)
->setDpr(2)
->build();
// Output: http://imgproxy.local/signature/width:800/height:600/.../image.webp
use Imsus\ImgProxy\Facades\ImgProxy;
ImgProxy::url('https://example.com/image.jpg')
->setWidth(800)
->setHeight(600)
->build();
// Output: http://imgproxy.local/signature/width:800/height:600/plain/https://example.com/image.jpg@jpeg
use Illuminate\Support\Facades\Storage;
// Public disk - uses disk->url()
Storage::disk('public')->imgproxy('avatars/user.jpg')
->width(300)
->height(200)
->webp()
->build();
// Private disk (S3) - automatically uses temporaryUrl()
Storage::disk('s3')->imgproxy('products/image.jpg')
->width(800)
->height(600)
->cover()
->build();
use Imsus\ImgProxy\Enums\ResizeType;
use Imsus\ImgProxy\Enums\OutputExtension;
$url = imgproxy('https://example.com/image.jpg')
->setWidth(800)
->setHeight(600)
->setResizeType(ResizeType::FILL)
->setExtension(OutputExtension::WEBP)
->setQuality(85)
->build();
bash
php artisan vendor:publish --tag="laravel-imgproxy-config"
bash
php artisan imgproxy:key