square1 / resized
On-demand image manipulation service.
2.0.1
2026-06-08 12:47 UTC
Requires
- php: ^8.2
- ext-iconv: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.95.0
- phpunit/phpunit: ^11.0|^12.0|^13.0
This package is auto-updated.
Last update: 2026-06-08 12:49:50 UTC
README
This is the PHP client for resized.co, a realtime image resize manipulation service.
Requires PHP 8.2 or higher.
Install
Via Composer
$ composer require square1/resized
Usage
// Initialize and authenticate $resized = new \Square1\Resized\Resized('key', 'secret'); // Override host if applicable $resized->setHost('https://img.resized.co'); // Set the default failover image (used when $url is null, empty, or invalid) $resized->setDefaultImage('http://www.example.com/no-image.jpg'); // Set default options $resized->setDefaultOptions(['quality' => 100]); // Process image resize. Parameters: ($url, $width, $height, $title, $options) // $url and $title accept string or null. Null $url falls back to the default image. // $width and $height accept int, string, or null. Null means no constraint on that dimension. $img = $resized->process('http://www.example.com/some-image.jpg', '100', '100', 'This is a title'); // Integer dimensions are also accepted $img = $resized->process('http://www.example.com/some-image.jpg', 100, 200); // Constrain only width, leave height unconstrained $img = $resized->process('http://www.example.com/some-image.jpg', 100); // Pass null URL to always use the default image $img = $resized->process(null, 100, 200);
Testing
$ composer test
License
The MIT License (MIT). Please see License File for more information.