Add an image preview and determine the width and height automatically.