PHP code example of astrotomic / php-weserv-images

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

    

astrotomic / php-weserv-images example snippets


use Astrotomic\Weserv\Images\Url;
use Astrotomic\Weserv\Images\Enums\Fit;

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

echo $url;
// https://images.weserv.nl/?w=512&h=512&we=1&fit=inside&url=https%3A%2F%2Fimages.weserv.nl%2Flichtenstein.jpg
bash
composer