Relative Link/URI for Thumb()?

Does Kirby not support uri() for thumbnails? I roughly have something like this:

<?php echo thumb($image, array('width' => 400, 'height' => 250))->uri(); ?>

But when I execute that, I get the error: Call to undefined method Asset::uri()

No, the available methods are inherited from the Media class. You can find the available methods here: https://getkirby.com/docs/toolkit/api#media

1 Like

With thumb($image, $params = array(), $obj = true) try:


<?php echo thumb($image, array('width' => 400, 'height' => 250), false); ?>

to get the url, but in front of that add code to verify that $image is an image object.

@anon77445132 That only returns a string, the URL, not a relative link.

Yes I know, but then we only have to catch the desired rest of that string using PHP…