PHP code example of elgentos / imgproxy-php
1. Go to this page and download the library: Download elgentos/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/ */
elgentos / imgproxy-php example snippets
$builder = new UrlBuilder("http://localhost:8080", "< your HEX key >", "< you HEX salt >");
// Generate imgproxy URL for an image, resizing to 300x200 with default settings (*)
$url = $builder->build("http://myimages.localhost/cats.jpg", 300, 200);
// By default, the URL is generated in basic mode
echo $url->toString();
// Customize URL params
$url->setFit("fill")
->setWidth(1200)
->setHeight(1200)
->setGravity("no")
->setEnlarge(true);
// switch to advanced URL mode with tons of extra features, superior to the basic mode:
$url->useAdvancedMode();
// set processing options:
$url->options()->withDpr(2)/* -> chain more with<FEATURE>() calls -> ... */;
echo $url->toString();