added event handler for capturing images