PARE THYMELEAD VARIABLE ONCLICK

<button th:onclick="'javascript:upload(' + ${gallery} + ')'"></button>
Shy Sheep