Reference

Guide

$asset

Anything in your public path can be converted to an Asset object to use the same handy file methods and thumbnail generation as for any other Kirby files. Pass a relative path to the Asset object to create the asset.

Details

You can create a new Asset object via the asset() helper or via the class constructor:

Via the helper

$asset = asset('assets/images/logo.svg');

Via the constructor

$asset = new Asset('assets/images/logo.svg');

With the object defined, you can then start calling the class's methods:

if ($asset->exists()) {
    echo $asset->width();
}