Images not store in texte fileof projects

Hi,
I’ve a problem for display images from files fields.
I can upload images for each project page I’m creating, they’re store in the content folder, but they’re not listed in the text file of the project. That result, I cannot display them in the webpage.

I’ve set image renderer as image magick and srcset in config file.

Screenshot_2024-03-25_16-15-56

here my project template :

title: Projet

status: 
  draft: Draft
  listed: published



columns: 
  main: 
    width: 1/2
    sections:
      content:
        type: fields
        fields: 
          tags:
            type: tags
          description:  
            label: description
            type: textarea


  sidebar:
    width: 1/2
    sections:
      medias:
        label: Images
        type: files
        layout: cards
        size: medium

and here my config

<?php 
     return [
	'environment' => 'local',
	'debug'=> true,
	'languages' => true,
	// thumbs
	'thumbs' => [
		'quality' => 80,
		'driver' => 'im',
		'bin' => 'convert',
		'srcsets' => [
            'default' => [380, 880, 1080]
        ]
	]
];

There’s a difference between files fields and files sections.
The files field stores content in the page; it lets you “select” files and then saves the uuid or name of the selected files in the page content file.
The section shows you all the uploaded files, but it doesn’t let you “select” them.

You are using a files section.

Depending on whether you want the user to be able to choose from the uploaded files or not, either the files field or section is better suited.

For example, in your template you can still display all uploaded images by simply using $page->images():

<?php foreach($page->images()->sortBy('sort') as $img): ?>
  <img src="<?= $img->resize(200)->url() ?>" alt="" />
<?php endforeach; ?>

This also allows you to, for example, simply upload some images to the folder (via FTP or stuff) and have them displayed without touching the panel.


if you prefer selecting them in the panel, you should use the field:

  sidebar:
    width: 1/2
    sections:
      fields2:
        type: fields
        fields:
          medias:
            label: Images
            type: files
            layout: cards
            size: medium

and in the template:

<?php foreach($page->medias()->toFiles() as $img): ?>
  <img src="<?= $img->resize(200)->url() ?>" alt="" />
<?php endforeach; ?>