Help with Alt in Images and Alt in Blocks

I’m looking for some help or advice on how people deal with an Alt info of an image in its’ metadata file (e.g. image.jpg.md) and the Alt info in Blocks.

For some reason I thought the Block would pick up the Alt info from the image metadata if it existed and show that or if not you could enter the Alt info and blocks would write that back to the image metadata file. It would seem that in blocks it does not do this, but stores the image Alt text within the main ‘md’ file.

So how do people deal with this? Just allow the possible different Alt info? Only add Alt info in Blocks and not allow it to be added to the image metadata file?

It makes more sense to me that the image metadata is attached to the image file as would I think be the case without blocks as you would be reading from the image.

Is there a way to get the image block to read and write the image metadata (e.g. image.jpg.md)

I could of course be missing something very obvious?

Hi there, @AudioBear, you can use a fallback solution.

If the image block alt is empty - use the image file alt

$alt = $block->alt()->isNotEmpty() ? $block->alt() : $image->alt();

And after just include <?= $alt ?> in your img alt code.

Thanks @mrfreedom, that seems like the best plan, but I also decided to only have Alt text entry on the images and not via the image block.