added patches for refactored media image gallery
changes to use refactored media image gallery