Hello there. I’m very new to Kirby and I love it so far. I’m running into an issue that maybe someone can help me with. The bottom line is that I’m trying to get the full URL of an image I’ve set in the blueprint.
Here’s an excerpt of the blueprint I’m using
fields: text: type: textarea size: huge cover: type: files label: Exposition empty: "No image selected"
Here’s an excerpt from the template:
<?php if ($page->cover()->exists()): ?> <div class="exposition" style="background-image: url('<?= $page->cover()->toUrl() ?>');"></div> <?php endif ?>
However, instead of giving me the full url of the image in place, it gives me the base url and then the filename with nothing in between. Specifically:
“http://xxx.xxxx.xx.xx/- 1 .jpg”
where the filename is 1.jpg
on a different page with a different image instead it responds with this:
http://xxx.xxxx.xx.xx/- > 16a25180-2215-4254-a4f2-7317a4983ea7 .jpeg
also of note: <?= $page->cover()->toFile() ?> works just fine as it creates an image tag in html.
Any thoughts on this? Maybe I’m not understanding how toUrl is supposed to work?