PHP library

Source code on GitHub
Package on Packagist


composer require tinytools/


First, you need to load the library's files by using Composer's autoloader. Second, instantiate the supplied TinyPictures\TinyPictures class with an $options array.

require_once __DIR__ . '/vendor/autoload.php';
$tinyPictures = new TinyPictures\TinyPictures([
    'user' => 'demo',
    'namedSources' => [
        'main' => ''

You can then use the public functions of the instance as described in the API section below.


user (string)
Mandatory. Your user name.
protocol ('https'|'http')
Optional. Default 'https'. Set to 'http' if you are running a non-TLS-encrypted website to save your users' devices from unnecessary computation time.
namedSources (['name' => 'url'][])
Optional. Default []. An array of arrays, each one describing a named source you configured on your dashboard. Copy the value directly from there.



This function converts any image URL to a URL. You can specify image processing operations in the options array.

Function parameters

$source (string)
Mandatory. URL of the original image.
$options (array)
Optional. Default []. Array containing the image processing operations you'd like to be applied.

Function returns



These examples assume that the user name is demo and there is a named source with the name main that points to

// ''

$tinyPictures->url('', ['width' => 200])
// ''

$tinyPictures->url('', ['width' => 200, 'height' => 100, 'resizeType' => 'cover', 'enlarge' => true])
// ''