use local function for extract thumbnail