Improve thumbnail size validation function