Image source unknown

Hi, I am trying to fetch cover pictures of subpages to create a projects overview. I am using this

<?php foreach($page->children() as $subpage): ?>
  <li>
     <a href="<?php echo $subpage->url() ?>">

  	<?php if($image = $subpage->cover()): ?>
    		<img src="<?php echo $image->url() ?>"/>
  	<?php endif ?>

	<?php echo html($subpage->title()) ?>
	</a>
  </li>
<?php endforeach ?>

It works fine with the title but the for the images its saying

<img src(unknown)>

I have tried this one as well but then the img tag is not showing up at all:

<?php if($image = $subpage->cover()->toFile()): ?>
    	<img src="<?php echo $image->url() ?>"/>
 <?php endif ?>

Can someone help me? Thanks!

What is cover in your blueprint? A files field? A files section? Please post your blueprint. If cover was a files field, you last example should work.

Hi Texnixe,
thanks for you response. I somehow managed to get it work with this blueprint:

title: Projekt

status:
  draft: Draft
  listed: Published

columns:
  - width: 1/3
sections:
  images:
    type: files
    layout: list
    template: image
    info: "{{ file.dimensions }}"
    image:
      ratio: 5/4
      cover: true
    min: 1
    size: small
  unterseiten:
    headline: Unterseiten
    type: pages
    status: draft
    templates: default

  - width: 2/3
fields:
  cover:
    type: files
    multiple: false
  headline:
    type: text
  description:
    type: textarea
    tags: true

I cant really tell what I did to make it right. However Thanks again for your help.