PHP code example of onliner / imgproxy-php

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

    

onliner / imgproxy-php example snippets


$key = getenv('IMGPROXY_KEY');
$salt = getenv('IMGPROXY_SALT');

$src = 'http://example.com/image.jpg';

$builder = UrlBuilder::signed($key, $salt);
$builder = $builder->with(
    new Dpr(2),
    new Quality(90),
    new Width(300),
    new Height(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

composer 

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