crocodile2u/imgproxy-php

URL generator for darthsim/imgproxy

v1.1.3 2019-04-19 10:51 UTC

This package is auto-updated.

Last update: 2020-10-19 16:59:10 UTC


README

See https://github.com/DarthSim/imgproxy.

This is a small package which allows for generating URLs for your images that are resized by imgproxy:

$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);
echo $url->toString();

// Customize URL params
$url->setFit("fill")
  ->setWidth(1200)
  ->setHeight(1200)
  ->setGravity("no")
  ->setEnlarge(true);
  
echo $url->toString();

(*) default settings:

  • Fit: fit
  • Gravity: sm (smart)
  • Enlarge: 0 (do not enlarge images)

Please refer to imgproxy docs for parameter descriptions and possible values.