I'm looking at using pchart to dynamically build graphs into a web app and then include the chart in a PDF... hopefully via writeHTML() rather than Image()
I thought I'd streamline the effort by simply modifying Example006.php and replacing the img src with an image from the pchart site (specifically, 'http//pchart.sourceforge.net/Pictures/example10.png')
Somewhat unexpectedly, I get the following message:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1570599827 bytes) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\tcpdf\tcpdf.php on line 4238
The image is not that large... 380px × 200px, 12.7 KB (13009 bytes)
(In other PDF exercises, I've successfully included an image that was 170KB... so why the error on this image?!?)
Any thoughts?
TIA
Al
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 529782 bytes) in /var/www/Development/ibsv3_caa/system/application/thirdparty/tcpdf/tcpdf.php on line 4795
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Probably this is caused by some internal loop due to a remote security restriction.
Please try to debug it a little bit to find out where the problem is.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I got the very same problem using Google Chart API to generate PNG image for charts (tcpdf 4.5.026):
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to
allocate 1589475898 bytes) in tcpdf.php on line 4454
I tracked to error to fread() call in function _parsepng($file). The fread is called with either very large values or with negative values which shows that there's error somewhere reading PNG data streamed from network.
I tried to post bug report on this, but unfortunately it was closed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I made some more testing, and it seems that the implementation of function _parsepng($file) does not support very well the case when the image file data is streamed from network. More specifically, the way the image data is read (i.e. reading and parsing PNG data in same loop) works ok with local files in the filesystem, but not always when the data comes from the network. See e.g. example #3 in http://fi.php.net/fread
I think this is obvious bug, since anything shouldn't crash with fatal error, really, and not because feeding fread with stale parameters. I have no suggestion how to fix this properly, reading remote images to a local temp file first before parsing would definitely work. A better solution would be some kind a rewrite to the image data reading & parsing loop.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
2GB. But there should be no reason in the world a simple 600kb graphic would do this. Not to mention that when i do the image locally, it works fine. Only when the image is remote does this problem occur.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm looking at using pchart to dynamically build graphs into a web app and then include the chart in a PDF... hopefully via writeHTML() rather than Image()
I thought I'd streamline the effort by simply modifying Example006.php and replacing the img src with an image from the pchart site (specifically, 'http//pchart.sourceforge.net/Pictures/example10.png')
Somewhat unexpectedly, I get the following message:
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1570599827 bytes) in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\tcpdf\tcpdf.php on line 4238
The image is not that large... 380px × 200px, 12.7 KB (13009 bytes)
(In other PDF exercises, I've successfully included an image that was 170KB... so why the error on this image?!?)
Any thoughts?
TIA
Al
This issue still occurs on 4.6.022.
Fatal error: Allowed memory size of 16777216 bytes exhausted (tried to allocate 529782 bytes) in /var/www/Development/ibsv3_caa/system/application/thirdparty/tcpdf/tcpdf.php on line 4795
Probably this is caused by some internal loop due to a remote security restriction.
Please try to debug it a little bit to find out where the problem is.
The latest TCPDF release contains some memory optimizations.
I got the very same problem using Google Chart API to generate PNG image for charts (tcpdf 4.5.026):
PHP Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to
allocate 1589475898 bytes) in tcpdf.php on line 4454
I tracked to error to fread() call in function _parsepng($file). The fread is called with either very large values or with negative values which shows that there's error somewhere reading PNG data streamed from network.
I tried to post bug report on this, but unfortunately it was closed.
I made some more testing, and it seems that the implementation of function _parsepng($file) does not support very well the case when the image file data is streamed from network. More specifically, the way the image data is read (i.e. reading and parsing PNG data in same loop) works ok with local files in the filesystem, but not always when the data comes from the network. See e.g. example #3 in http://fi.php.net/fread
I think this is obvious bug, since anything shouldn't crash with fatal error, really, and not because feeding fread with stale parameters. I have no suggestion how to fix this properly, reading remote images to a local temp file first before parsing would definitely work. A better solution would be some kind a rewrite to the image data reading & parsing loop.
OK, I've fixed this on TCPDF 4.5.027.
Table format is also not coming. If any colspan is present in html structure then Division by 0 error is coming.
Does it go away when you up the memory limit?
Negative. However, it still looks like that PNG remote image deal.
Maybe so. But to what value did you increase it?
2GB. But there should be no reason in the world a simple 600kb graphic would do this. Not to mention that when i do the image locally, it works fine. Only when the image is remote does this problem occur.