1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-12 08:04:05 +02:00

Flextype Slim Integration - bootstrap - updates

This commit is contained in:
Awilum
2019-02-26 02:46:30 +03:00
parent 3259413b38
commit 0e8b792478
2 changed files with 18 additions and 11 deletions

View File

@@ -41,7 +41,8 @@
"flextype-components/text" : "1.1.2",
"league/glide": "^1.4",
"slim/slim": "^3.0",
"slim/twig-view": "^2.4"
"slim/twig-view": "^2.4",
"league/glide-slim": "^1.0"
},
"autoload": {
"classmap": [

View File

@@ -20,6 +20,8 @@ use Flextype\Component\Filesystem\Filesystem;
use Thunder\Shortcode\ShortcodeFacade;
use Slim\Http\Request;
use Slim\Http\Response;
use League\Glide\ServerFactory;
use League\Glide\Responses\SlimResponseFactory;
/**
* The version of Flextype
@@ -171,17 +173,14 @@ $flextype['images'] = function($container) {
$api = new \League\Glide\Api\Api($imageManager, $manipulators);
// Setup Glide server
$server = new \League\Glide\Server(
$source,
$cache,
$api
);
$server = \League\Glide\ServerFactory::create([
'source' => $source,
'cache' => $cache,
'api' => $api,
'response' => new SlimResponseFactory(),
]);
return new \League\Glide\Server(
$source,
$cache,
$api
);
return $server;
};
/**
@@ -232,12 +231,19 @@ $flextype['view'] = function ($container) {
return $view;
};
/**
* Generates and returns the image reponse
*/
$app->get('/image/{path:.+}', function (Request $request, Response $response, array $args) use ($flextype) {
return $flextype['images']->getImageResponse($args['path'], $_GET);
});
/**
* Init plugins
*/
$plugins = new Plugins($flextype, $app);
/**
* Run application
*/