added function for show thumbnail and save into db