1. Go to this page and download the library: Download hosmelq/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/ */
hosmelq / laravel-imgproxy example snippets
use HosmelQ\Imgproxy\Laravel\Facades\Imgproxy;
use HosmelQ\Imgproxy\ResizingType;
$url = Imgproxy::builder()
->resize(ResizingType::Fill, 300, 300)
->quality(80)
->build('https://example.com/avatar.jpg');
use HosmelQ\Imgproxy\ResizingType;
use function HosmelQ\Imgproxy\Laravel\imgproxy;
$url = imgproxy()
->resize(ResizingType::Fit, 1200)
->build('https://example.com/header.jpg');
use HosmelQ\Imgproxy\Laravel\ImgproxyManager;
use HosmelQ\Imgproxy\ResizingType;
final class AvatarUrl
{
public function __construct(private ImgproxyManager $imgproxy) {}
public function handle(string $source): string
{
return $this->imgproxy->builder()
->resize(ResizingType::Fill, 300, 300)
->build($source);
}
}