Skip to content
This repository has been archived by the owner on Mar 22, 2020. It is now read-only.

Commit

Permalink
Create a new route to serve thumbnails.
Browse files Browse the repository at this point in the history
  • Loading branch information
nrocco committed Nov 21, 2015
1 parent cd5c9a3 commit d99223b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions web/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@
return $app->sendFile($app['api']->fetchFile($hash));
});

$app->get('/thumbs/{hash}', function($hash) use ($app) {
$thumb = $app['restapi']['thumbs_path']."/".$app['storage']->hashToFilePath($hash).".png";

try {
return $app->sendFile($thumb);
} catch (\Exception $e) {
return new \Symfony\Component\HttpFoundation\Response(null, 404);
}
});

$app->get('/{table}', function($table) use ($app) {
return $app['api']->readCollection($table, $app['request']->query->all());
});
Expand Down

0 comments on commit d99223b

Please sign in to comment.