1. Go to this page and download the library: Download rikodev/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/ */
rikodev / laravel-imgproxy example snippets
use RikoDEV\LaravelImgproxy\Options;
use RikoDEV\LaravelImgproxy\Enums\ResizeType;
use RikoDEV\LaravelImgproxy\Enums\Gravity;
use RikoDEV\LaravelImgproxy\Enums\Format;
imgproxy($url, new Options(...))
use RikoDEV\LaravelImgproxy\Facades\Imgproxy;
Imgproxy::url($url, new Options(...))
use RikoDEV\LaravelImgproxy\ImgproxyManager;
class MyService
{
public function __construct(private readonly ImgproxyManager $imgproxy) {}
public function thumbnail(string $url): string
{
return $this->imgproxy->url($url, new Options(width: 400, height: 300));
}
}
new Options(
width: ?int, // Output width in pixels
height: ?int, // Output height in pixels
resize: ResizeType, // Resize algorithm (default: ResizeType::Fit)
gravity: ?Gravity, // Crop gravity / focus point
quality: ?int, // Output quality 1–100 (JPEG / WebP)
enlarge: bool, // Allow enlarging beyond original size (default: false)
format: ?Format, // Convert to this format (also sets the file extension)
blur: ?float, // Gaussian blur sigma 0.3–1000
brightness: ?int, // Brightness adjustment -255–255
contrast: ?float, // Contrast multiplier
saturation: ?float, // Saturation multiplier
)