Child image from parent only returning the name of the file

I am trying to get a cover image from the parent.

This is the blueprint of the child.

title: Produccion
preset: page
fields:
  cover:
    label: Cover
    type: files
    translate: false
    multiple: false
    layout: cards

and in the parent i am doing:

<?php 

  foreach($page->children()->listed() as $produccion){
  
    $cover = $produccion->cover();
    echo $cover->crop(500,500);
    echo "<br>";
    
  }

?>

But nothing I do change the result. I only get the name of the files: y try grayscale, url() but i always the name of the file.

- image-a.jpg
- image-b.jpg
- image-c.jpg

Hi, looks like is my fault.

if miss: ->toFile()

$cover = $production->cover()->toFile();

@italoestrada Right, that was missing but you’d better also wrap this in an if statement, because you can’t rely on the presence of the image:

<?php 

  foreach($page->children()->listed() as $produccion){
  
    if ( $cover = $produccion->cover()->toFile() ) {
      echo $cover->crop(500,500);
      echo "<br>";
    }
    
  }

?>