PHP code example of everzel / weserv-php

1. Go to this page and download the library: Download everzel/weserv-php 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/ */

    

everzel / weserv-php example snippets


use Everzel\WeservImages;
use Everzel\Enums\Fit;

$weserv = WeservImages::make('https://images.weserv.nl/lichtenstein.jpg', 'https://wsrv.nl', false);

$url = $weserv
    ->w(512)
    ->h(512)
    ->we()
    ->fit(Fit::INSIDE->value);

echo $url;

function weserv(string $imageUrl) {
    return WeservImages::make($imageUrl, 'https://wsrv.nl', false);
}

$url = weserv('https://images.weserv.nl/lichtenstein.jpg')
    ->w(512)
    ->h(512)
    ->we()
    ->fit(Fit::INSIDE->value);

echo $url;
bash
composer