everzel/weserv-php

1.0.4 2023-08-03 08:55 UTC

This package is auto-updated.

Last update: 2024-11-03 11:26:47 UTC


README

This package provides a fluent PHP OOP builder for images.weserv.nl.

Installation

You can install the package via composer:

composer require everzel/weserv-php

Usage

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;

Or

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;