Ended up going a different route for this issue. Rather than adding the images to the media tab and then selecting them individually from the content page, this allows users to just select an entire folder and creates the gallery that way.
<!-- Displays all images from a folder in the Media Library -->
<xsl:if test="number($mediaFolderId)">
<div class="galleryContainer">
<xsl:for-each select="umbraco.library:GetMedia($mediaFolderId, true())/Image">
<xsl:if test="umbracoFile !=''">
<a href="{umbracoFile}" title="{umbracoDescription}" rel="prettyPhoto [gallery]">
<img class="galleryWatermark" src="/images/logo_watermark.png" alt="{@nodeName}" title="{@nodeName}" style="background:url({umbracoFile}) top no-repeat; background-size:180px; width:100%; height:100%;" />
</a>
</xsl:if>
</xsl:for-each>
</div>
</xsl:if>