changed the image storage function and image preview modal