Skip to content

Instantly share code, notes, and snippets.

@janit
Last active October 4, 2015 17:00
Show Gist options
  • Save janit/971ee402c91379396858 to your computer and use it in GitHub Desktop.
Save janit/971ee402c91379396858 to your computer and use it in GitHub Desktop.
images2.php
<?php
$app->get('/images'), function () use ($app) {
$images = array('/images/1.jpg','/images/2.jpg','/images/3.jpg');
$response = new JsonResponse($images);
foreach($images as $image){
$response->headers->set('link','<' . $image . '>; rel=preload; as=image',false);
  }
 
return $response;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment