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

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.