I'm sure it could be done that way, but if you're using my gallery just do a
show galleryimage
hide galleryimage
instead of setting a persistent.variable the image is not displayed and it gets unlocked in my gallery, you can do this multiple time to unlock more than one image at a time.
show galleryimage1
hide galleryimage1
show galleryimage2
hide galleryimage2