@nbd Err, I wrote that it's in nightly. It's not, I read it wrong. :)
Anyway, instead of that thing, maybe you could try changing to === instead of == before the IMAGETYPE_JPEG in the if statement. I noticed now, after I wrote so confidently that it was "===", that it wasn't. And non-strict comparisons in PHP is more madness than SPARTAAAAA.