php - PDF rendering issue using tcpdf
I’ve developed a feature in my application which takes some images and rendered to one pdf according to user. This functionality is working okay in my stage server but this shows me “server error” on production.
I verified error logs of apache and I found following errors
libpng warning: Ignoring attempt to set cHRM RGB triangle with zero area
Corrupt JPEG data: 234 extraneous bytes before marker 0xd9
The application is created on cakephp, the library for rendering pdf is tcpdg and staging and production servers are on ubuntu. I’ve consult some senior guys, they all are saying this is GD problem.
The environment on stage server
PHP 5.3.3-0.dotdeb.1 with Suhosin-Patch (cli) (built: Oct 1 2010 08:49:29)
Copyright (c) 1997-2009 The PHP Group
The environment on production server
PHP 5.3.2-1ubuntu4.18 with Suhosin-Patch (cli) (built: Sep 12 2012 19:12:47)
Copyright (c) 1997-2009 The PHP Group
Please recommend me any risk free solution.
Answer
Solution:
There are some garbage bytes after the end of the image for any reason which stop it to work.
You can do a work around to find "\xFF\xD9" in your image bytes which represents EOI (End of Image) and where ever you find it chop the bytes after it. Hopefully this will work.
Answer
Solution:
During diagnosis this issue. I noticed that ImageMagick module wasn't loaded on our staging server. That's why it was working on staging server. We disabled it from production server and it works. It was causing some conflicts with GD.
I commented out following extension
Thanks anyways