imagejpeg issues with PHP 5.4

Came across an interesting little issue this afternoon while debugging an issue with a very old osCommerce installation. This particular site uses an on the fly product thumb generator (product_thumb.php) which worked fine with PHP 5.3 but failed with PHP 5.4.

After a bit of digging I tracked the issue to this line in the original code:

imagejpeg($src, '', 100);

In PHP 5.4 this fails, and needs to be replaced with:

imagejpeg($src, NULL, 100);

Perhaps this will save someone a bit of time. I didn’t find this problem noted elsewhere.

Tags:

2 responses to “imagejpeg issues with PHP 5.4”

  1. Danny says:

    I came across the same issue, also after debugging found the same issue / fix. Couldn’t find this change of behaviour in a changelog, but now with this post I have an confirmation 😉

  2. florin says:

    Nice one ! Helped me alot. TKS for sharing !

Useful? Interesting? Leave me a comment

I've yet to find a way of allowing code snippets to be pasted into Wordpress comments - so if you're trying to do this you'd be better off using the contact form.