The code here is excerpted from the complete plugin I have for creating custom post types, taxonomies, and blocks. (There are lots more blocks in the original.) The structure of that plugin is plugin-folder/acf-blocks/block-templates/
.
This code will not work without Advanced Custom Fields Pro installed and active.
Added an ALT tag text field so people can use proper alt text. Though I'm thinking I should add a fallback for it, or a conditional, or something, I haven't tested that yet.