add image gallery edit functionality (mostly working)