How to add multiple images for a product (without variants) and for products with variants?

for products with variants how to make a specific pic to load on choosing a variant?