thumbnail logic