Using a direct file link to image in a template?

Each post on my site has an image designated as the cover which is used as its preview on the homepage; i have a field in the panel to select it which puts a direct file link in the .txt file (ex. “- file://IJSG5ov1QH4EGGpA”) and I’m having trouble using it in my templates. Right now the cover component looks like this:

                  <?php if ($cover = $item->cover()): ?>
                  <img src="<?= $cover->url() ?>" >
                  <?php endif ?>

which just plugs “- file://IJSG5ov1QH4EGGpA” directly into the src attribute, but this doesn’t display the image properly on the page just a blank box. Is there another particular way of employing these kinds of direct file links?

Should be

<?php if ($cover = $item->cover()->toFile()): ?>
  <img src="<?= $cover->url() ?>" >
<?php endif ?>

Thanks Sonja!