Rebuild photos database