Fixed JPEG problem

The file upload jpeg raised an exception in downsizing.
I have no idea why the switch does not work.
So I decided to convert it into a cascade of if.
I know it sucks, but I have not found another solution.