Is it possible to show all images from visible projects on Index/Home?

New to Kirby. Have been playing around with it for few days now and I am curious if it is possible to show all images from all visible projects on the index (home).

If it helps, the home page will work as an index showing all images from all projects in masonry-like format of thumbs which users can click to view each image at full size with project description in a lightbox or similar.

Yes, let’s assume you wanted to get all images from all visible children of a page called projects:


  $projectPages = page('projects')->children()->visible();
  $projectImages = $projectPages->files();

  foreach($projectImages as $projectImage) {
   echo thumb($projectImage, array('width' => 300, 'height' => 300))->url();

If you need to get images from different levels, you have to use multiple foreach loops to fetch all images and add them to a new Collection.

1 Like

Nice! I’ve got it working. Several steps before the index is done, my to-do:

  • Index filter based on entries’ tags
  • Paginate and implement infinite scroll with lazy load
  • Continuous fancybox/lightbox but show corresponding project description

May have to come back here to ask further questions, haha.