Use JPEG instead PNG in the thumb files.
(int) instead intval()
Bugs fix.