fixed galleryAddPic function