Reference

Guide

$page->hasImages()

Checks if the Files collection has any images

$page->hasImages(): bool

Return type

bool

Example

<?php
echo $page->hasImages(); //will echo 1 if true, nothing if false

if($page->hasImages()) {
  $images = $page->images();
}
?>

What is an image file?

Kirby considers the following file types as images:

  • jpeg
  • jpg
  • jpe
  • gif
  • png
  • svg
  • ico
  • tif
  • tiff
  • bmp
  • psd
  • ai
  • eps
  • ps

Source code

kirby/src/Cms/HasFiles.php#L160