Create a function to be called on image selected