added snap picture function and fixed timeout xhr issue.