Whats the best way to fetch an image from your assets folder?

I currently have an image I’m trying to fetch from my assets folder by using
<img src="<?php echo image('assets/images/Adam-Rasheed-Headshot-Silly-1024.jpg')->url() ?>" alt="">

But this is giving me a “Call to a member function url() on null” error in the Kirby Debugger.

How do I correctly fetch an image file from my assets folder, similar to how I fetched my CSS files:
<?= css('assets/css/main.css') ?>

See this post: How do you use asset urls? … and the responses.

1 Like