Mmmm... I think that you don't need the GetDirectory function. Comment it and change this line of your code:
Instead of
<ctl:Gallery runat="server" ID="Gallery1" FolderUrl='<%#GetDirectory()%>' Size="100" />
Put this:
<ctl:Gallery runat="server" ID="Gallery1" FolderUrl='<%=Me.Directory%>' Size="100" />
Hope that helps.