Fixes image layout when app metadata is really long

Previously images would get written off the bottom of the page. This change makes sure that new pages are inserted if needed.