Sorry - I should have qualified my statement.
A very large percentage of the time, a JPG is already compressed as far as it will go. In those cases, when you zip it up, you gain a few bytes for the overhead of the zip file itself.
In your example, yes, a large JPG where the Quality was left high, a compression will have a benefit.
Sorry, I should have been more clear.
As for the syntax error, look on lines before and after line 45. For example, if you leave out a quote, semicolon, or a parenthesis, the line that PHP reports isn't always the line that has the problem.