Skip to content

Repository files navigation

ImgProxy PHP

This is a PHP library that makes it easy to build URL for ImgProxy.

VersionTotal DownloadsPhpLicenseBuild Status

Installation

The preferred way to install this extension is through composer.

Either run

composer require onliner/imgproxy-php:^0.2

or add this code line to the require section of your composer.json file:

"onliner/imgproxy-php": "^0.2"

Usage

$key = getenv('IMGPROXY_KEY');
$salt = getenv('IMGPROXY_SALT');
$src = 'http://example.com/image.jpg';
$builder = UrlBuilder::signed($key, $salt);
$builder = $builder->with(
newDpr(2),
newQuality(90),
newWidth(300),
newHeight(400)
);
$url = $builder->url($src); // encoded url$url = $builder->encoded(false)->url($src); // plain url$url = $builder->url($src, 'png'); // change image format# example: /9SaGqJILqstFsWthdP/dpr:2/q:90/w:300/h:400/aHR0cDovL2V4YW1w/bGUuY29tL2ltYWdl/LmpwZw

License

Released under the MIT license.

About

Imgproxy URL builder for PHP with URL signing and flexible path generation.

Topics

Resources

Stars

25 stars

Watchers

9 watching

Forks

Releases

Packages

Used by

Contributors

Languages