Kirby Builder plugin: `_fileUrl` variable returns wrong URL in the Panel

First off, big thanks to @timoetting for the great plugin!

I’m not sure if this is specifically related to the plugin or not, but whenever I use the example from the Readme: <img src="{{_fileUrl}}{{picture}}" height=120px/></br> I get a 404 for any images; the URL being returned in the Panel is localhost/image.jpg if I’m editing the Home page, while it should be localhost/content/home/image.jpg. Is it possible I’m doing something wrong?

I was also wondering if it might be possible to control the modal size, as is possible for the core Kirby structure fields.

Thanks in advance for any help!

Funny, I just solved the same problem 10sec ago… :tired_face:
My issue is that I have special routing in config, if I remove the routing the
image displays, think that is´s a bug regarding to the panel itself. Anyway replace line “35” in builder.php with this and you are good to go:

$data->_fileUrl = kirby()->urls()->content() .'/'. $this->page->diruri() . '/';

Toolkit version: 2.2.3
Kirby version: 2.2.3
Panel version: 2.2.3

Thanks for the quick response, @A_Monkey! That solved it!

Your welcome sir! :innocent:

Or just:

$data->_fileUrl = $this->page->contentUrl() . '/';
1 Like

lol the support is killing it !! :grin:

1 Like

You are welcome. :smiley:

Should be in the docs :wink:

1 Like

Big thanks to all of you. The latest version of Kirby Builder now uses contentUrl().

I just downloaded the latest Kirby Builder and the file path is still not correct. The problem was that the _fileUrl ended the path with a forward slash ( \ ), not a backward ( / ) slash.

builder.php, line 35…

$data->_fileUrl = $this->page->contentUrl() . DS;

should be changed to …

$data->_fileUrl = $this->page->contentUrl() . '/';