Thanks for the help in advance, everyone!
The first section of my website should display two simple image.
I configured the landing.yml
inside the pages’ folder of my blueprints:
title: Landing
fields:
image1:
label: First Image
type: files
max: 1
help: "Upload the first image."
query: page.files.filterBy('type', 'image')
image2:
label: Second Image
type: files
max: 1
help: "Upload the second image."
query: page.files.filterBy('type', 'image')
the backend looks great and allows me to upload two images into my content folder that is structured like this:
content
- 1_Home
↳ home.txt - 2_Home
↳home.txt - 3_Landing
↳image1.jpg
↳image1.jpg.txt
↳image2.jpg
↳image2.jpg.txt
↳landing.txt
When I upload images through the backend, they appear correctly in the landing folder of my content folder. But the landing.txt stores incorrect file paths:
the landing.txt looks like this:
Title: Landing
Template: landing
Image1: - file://k6Eti5Oh6PKC9sEa
Image2: - file://ornCG1qf7jlzxEyC
Uuid: VT5gw1zJ3y9JTEI9
This results as my images not being fetched through my php and therefore not displayed on my website:
<section id="landing">
<div class="frame frame1">
<?php
$landingPage = page('landing');
if ($landingPage):
echo "<p>Landing page found!</p>";
if ($image1 = $landingPage->image1()->first()):
echo "<p>Image 1 found!</p>";
echo "<img src='" . $image1->url() . "' alt='Landing Image 1' />";
else:
echo "<p>No image found for frame 1</p>";
endif;
else:
echo "<p>Landing page not found!</p>";
endif;
?>
</div>