partial code for metadata-and-image handler.