Update thumbnail.php

Updating with a few fixes, I guess there were some errors as it was before.