studiow / glideformat
Use the excellent glide api with named presets
v1.0.0
2016-01-07 15:37 UTC
Requires
- php: ^5.4 | ^7.0
- league/glide: ^1.0
Requires (Dev)
- mockery/mockery: ~0.9
- phpunit/phpunit: ^4.7
This package is auto-updated.
Last update: 2025-01-24 21:54:45 UTC
README
Use the excellent glide api with named presets
Some basic examples
$server = Studiow\GlideFormat\GlideFormatServer::createServer([ "source" => '/path/to/uploads', "cache" => '/path/to/cache', ]); $server->addPreset("thumbnail", ["w" => 100, "h" => 150, "fit" => "crop"]);
And when using a router, you could something like this:
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; // create $server like above $router = new \League\Route\RouteCollection(); $router->get("/img/{format}/{filename}", function(Request $request, Response $response, array $args) use ($server) { $server->outputImage($args['filename'], $args['format']); });