First you need to setup global image or color for each attribute values.To do that visit attributes tab under products menu and add your attribute like this.


Once Attribute is added , click on settings icon to define its options.


Now add the options as shown in the image.


Once color or image value for all usable attribute and its options are set , you can use it on product.To use it on products visit attributes tab and select "color" inplace of custom product attributes and then click on add


Set your variable products now and then visit colored variables tab and select image or color in place of dropdown select and update the product . thats it now frontend will replace image or color with default select .