Most likely all the errors are being caused by one initial problem.
Examining lines 311 and 315, looking for what would cause the error message given for those lines (Division by zero), we can see that $thumb_x has a zero value.
This is the second parameter in the function -
There is a call to this function at line #425 -
This function is only called if the $thumbWidth is greater than zero, so it leaves the lines in the function that modify $thumb_x. The following lines can set $thumb_x to zero, if $image_width is zero -
The function getimagesize(...) can return a FALSE value if the file it is testing is not an image. In this case, $image_width would be null/zero, which is causing the first two error messages. The other error messages are probably (I only traced through the errors to the point of determining the above information) because the file name in $sourceFilename is not an image. The code should test for a FALSE value returned by getimagesize(...) and take appropriate action.