Pela galeria could mean 1- in the gallery site, the entire buiding, maybe as a promoter, or 2-the gallery hired the person. Para a galeria means she works for the company
and unfortunately we can't set a rule since it varies from language to language and depending on the context =/ you'll learn by using them, be confident!!