Launched a new website, this one is for Woosta Pizza located in the hear of Worcester Massachusetts. The client has a basic static website with an online menu system they can update through an administration panel. To view this website click the link below
Month: March 2008
php 5 and imagecreatefromjpeg() recoverable error: Premature end of JPEG file
Ok I recently came up with a problem creating thumbnails for a project I am working on. I was stumped for hours, it seems that some files that were saved from a mac or certain photo editing programs would cause php to not recognize it a jpg thus giving the error:
imagecreatefromjpeg() : gd-jpeg, libjpeg: recoverable error: Premature end of JPEG
After researching this problem I realized it was a problem with php 5 and gd2. Heres how to fix it
- php 4 : No action neccesarry it should work fine
- php 5.0 – 5.1.2 = Upgrade to the latest php 5
- php 5.1.3 – current = Declare this variable in your file before calling imagecreatefromjpeg()
ini_set(‘gd.jpeg_ignore_warning’, 1);
Doing that will cause gd2,php to ignore the error and continue where it use to just fail and do nothing.