fixed gallery issue

fixed an issue with image array not being created from database