Skip to content

Commit

Permalink
added max age and etag
Browse files Browse the repository at this point in the history
  • Loading branch information
ychadwick committed Jan 26, 2015
1 parent 94a5183 commit f49a854
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Controller/MediaController.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;
use Symfony\Component\Validator\Constraints\Date;

class MediaController extends BaseMediaController
{
Expand Down Expand Up @@ -60,8 +61,10 @@ public function viewImageAction(Request $request, $id, $format = 'reference')

$response = new Response($file->getContent(), 200, $headers);

$response->setLastModified($media->getUpdatedAt());
$response->setPublic();
$response->setMaxAge(604800);
$response->setLastModified($media->getUpdatedAt());
$response->getEtag(md5(sprintf('image_%s_updated_at', $id)));


return $response;
Expand Down

0 comments on commit f49a854

Please sign in to comment.