Skip to content

Kirby 3.9.8

$page->hasImages()

Checks if the Files collection has any images

$page->hasImages(): bool

Return type

bool

Parent class

Kirby\Cms\Page

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