partial implementation of image preview