world-game/site/templates/play.json.php
isUnknown 689ec3b138
All checks were successful
Deploy / Deploy to Production (push) Successful in 25s
portfolio : fix gallery loading and optimize image sizes refs #59
- Remove GalleryAnimation preloading (was downloading full-size originals
  via new Image(), causing 5MB+ redundant downloads on top of WebP srcset)
- Gallery now shows immediately, images load lazily via DOM
- Force eager loading on mockup img when slide becomes active (fixes
  first-project gallery never showing — lazy img off-screen on bg slide)
- Resize all direct ->url() calls to appropriate display dimensions:
  gallery src 600px, mockup src 960px, backgrounds 1920px,
  play lettering 500px, play preview 1000px, team photos 400px

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-15 08:12:55 +02:00

23 lines
977 B
PHP

<?php
$specificData = [
'games' => $page->children()->listed()->map(function($game) {
return [
'title' => $game->title()->value(),
'slug' => $game->slug(),
'lettering' => $game->lettering()->toFile()?->resize(500, null, 80)->url(),
'description' => $game->description()->value(),
'thumbnail' => $game->thumbnail()->toFile()?->url(),
'thumbnailSrcset' => $game->thumbnail()->toFile()?->srcset('thumbnail'),
'thumbnailWebp' => $game->thumbnail()->toFile()?->srcset('thumbnail-webp'),
'backgroundImage' => $game->backgroundImage()->toFile()?->resize(1920, null, 80)->url(),
'preview' => $game->preview()->toFile()?->resize(1000, null, 80)->url(),
'playLink' => $game->playLink()->value() ?: null,
];
})->values()
];
$pageData = array_merge($genericData, $specificData);
header('Content-Type: application/json');
echo json_encode($pageData);