simplify frontend thumbnail code