Update: i found out that the collection is not empty. It just look like it because my browser didn’t show the error message except in the source code … here it is:
Fatal error: Call to a member function caption() on integer in […]/kirby (final)/site/templates/home.php on line 50
(caption
is a field of the image meta file)
Edit:
Yeah … I found a workaround at least … here’s my code
$galleryPage = $pages->find('galerie');
$galleryChilds = $galleryPage->children()->visible();
$galleryImages = new Collection();
foreach ($galleryChilds as $c) {
foreach ($c->images() as $i) {
$galleryImages->data[] = $i;
}
}
$galleryImages = $galleryImages->filterBy('filename', '!*=', '-big');
shuffle($galleryImages->data);
$galleryImages = $galleryImages->limit(6);
But maybe @bastianallgeier could take a look at it …