In kirby 3 I tried to exlude the cover image from the photo gallery as I did before in my Kirby 2 portfolio, but I can’t make it work, even with the same code, and even with the example code:
Oh OK, I can’t find the topic but if I recall correctly Kirby 2 require a string only for images()->not() (not files()->not()), I think it was a bug and that’s why I coded my Kirby 2 portfolio with fileName(), which is working (because I asked the exact same question few years ago).
Maybe the bug is gone in Kirby 3?
it works with not($page->cover()->toFile()) but I dismissed this solution as I have <?php ($cover = $page->cover()->toFile() ?> earlier in the file and whan I tried not($cover) and this doesn’t work.
//edit the $cover variable was in an if statement <?php if ($cover = $page->cover()->toFile()): ?>, maybe it doesn’t set it for the rest of the page?
I missed that you are talking about the Starterkit and the album page. In the Starterkit, $page->cover() in the album template already returns a file object (either from what is stored in the cover field or the first image), so calling toFile() doesn’t make sense here (the album page uses a page model).
Yes it works, I was just wondering why $cover alone doesn’t work, but it’s because I don’t pass the variable in the snippet (I though that it was not necessary as it was on the same page)