protected function initializeResponder($request)
 {
     $config = new ResourceManager(__DIR__);
     $config->setPath('cache', 'tmp/cache');
     $config->setPath('files', 'images');
     $config->compat();
     $app = new Application(array('resources' => $config));
     $app->register(new \Bolt\Provider\CacheServiceProvider());
     $responder = new ThumbnailResponder($app, $request);
     $responder->initialize();
     return $responder;
 }
 protected function initializeResponder($request)
 {
     $container = new Pimple(array('rootpath' => __DIR__, 'pathmanager' => new PlatformFileSystemPathFactory()));
     $config = new ResourceManager($container);
     $config->setPath('cache', 'tmp/cache');
     $config->setPath('files', 'images');
     $config->compat();
     $app = new Application(array('resources' => $config));
     $app->register(new CacheServiceProvider());
     $responder = new ThumbnailResponder($app, $request);
     $responder->initialize();
     return $responder;
 }
 public function connect(Application $app)
 {
     /** @var \Silex\ControllerCollection $controllers */
     $controllers = $app['controllers_factory'];
     $controllers->get('/{thumb}', function (Application $app) {
         if (isset($app['thumbnails'])) {
             $action = $app['thumbnails'];
         } else {
             $action = new ThumbnailResponder($app, $app['request']);
         }
         if ($response = $action->respond()) {
             return $response;
         } else {
             $app->pass();
         }
     })->assert('thumb', '.+')->bind('thumb');
     return $controllers;
 }
示例#4
0
 public function connect(Application $app)
 {
     // creates a new controller based on the default route
     $controllers = $app['controllers_factory'];
     $controllers->get('/{thumb}', function (Application $app) {
         if (isset($app['thumbnails'])) {
             $action = $app['thumbnails'];
         } else {
             $action = new ThumbnailResponder($app, $app['request']);
         }
         if ($response = $action->respond()) {
             return $response;
         } else {
             $app->pass();
         }
     })->assert('thumb', '.+');
     return $controllers;
 }