taking photo or load from gallery efficiently resizing and rotate if necessary