$site->image($filename = false)

Returns a specific image $file object by filename. If no filename is given, the first image will be returned.

  • return ($file)

Example

Fetching the first image

<?php if($image = $site->image()): ?>
<img src="<?= $image->url() ?>" alt="">
<?php endif ?>

Fetching a specific image

<?php if($image = $site->image('myimage.jpg')): ?>
<img src="<?= $image->url() ?>" alt="">
<?php endif ?>

Is something missing or incorrect? Edit this page on Github…