handling taking and previewing photo