Update generate_thumbnail function

The function generate_thumbnail now can crop photos
and put the focus in the center of it.

Change-Id: I1806e6f8f3acb541a1578f2c49212eb4290f6707