The Media Library already lets you edit and manage images.
If you want the layout to apply to a certain page, then that should be stored with the page (custom field).
There is already a mechanism to attach multiple images to a page. No other is needed.
Somehow, this sounds like it should be part of the editor (a new block perhaps?) instead of a theme.
]]>