->alt() not working?

I’m puzzled. I try to acces the images alt-information as documented here in the forum:
alt="<?= $image->alt()->html() ?>"
but all I’m getting is the images name with a hyphen at the front:
alt="- imagenam.jpg"
Did this change in version 3?

Weird, no it hasnt changed <?= $image->alt() ?> is enough. that looks like the content data, without being turned into a file object. Seems like its just giving you the literal value from the content file. Could you please share the whole php you are using for the image tag? also, in order of it to work, you need an alt field with a value in it in the files meta data.

Thanks for your fast response.
Could it have to do with the fact, that the image is selected though a files field?
And I actually have to fetch it with the ->toFile() command?
<img src="<?= $image->toFile()->url() ?>

Yes it did … thanks for making me rethink where I went wrong.
The ->toFile() command had to be within the the conversion to the $image