Skip to content

Commit

Permalink
Added lazy-loading images also to categories and tags
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Fey <info@sebastianfey.de>
  • Loading branch information
seyfeb committed Dec 7, 2020
1 parent b0d1910 commit 5dfe91a
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/Controller/MainController.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,13 @@ public function category($category) {
't' => $this->service->getRecipeMTime($recipe['recipe_id'])
]
);
$recipes[$i]['imagePlaceholderUrl'] = $this->urlGenerator->linkToRoute(
'cookbook.recipe.image',
[
'id' => $recipe['recipe_id'],
'size' => 'thumb16'
]
);
}

return new DataResponse($recipes, Http::STATUS_OK, ['Content-Type' => 'application/json']);
Expand Down Expand Up @@ -207,6 +214,13 @@ public function tags($keywords) {
't' => $this->service->getRecipeMTime($recipe['recipe_id'])
]
);
$recipes[$i]['imagePlaceholderUrl'] = $this->urlGenerator->linkToRoute(
'cookbook.recipe.image',
[
'id' => $recipe['recipe_id'],
'size' => 'thumb16'
]
);
}

return new DataResponse($recipes, Http::STATUS_OK, ['Content-Type' => 'application/json']);
Expand Down

0 comments on commit 5dfe91a

Please sign in to comment.