It is a known limitation to xml parser, it could not work with files bigger than 10 mb.
This could be solved by reading the SVG images in chunks, like here, but it is still not implemented. I tried to do it in my own way, but no luck, is there somebody who tried to fix this?
My code:
$fopen = fopen($svgdata, "r");
while($fileContents = fread($fopen, 102410245))
{
if (!xml_parse($parser, $fileContents, feof($fopen)))
{
$error_message = sprintf('SVG Error : %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser));
$this->Error($error_message);
}
}
Hi all,
When handling huge SVG images, I get the error:
xml_parse(): SVG Error: No memory at line 8
It is a known limitation to xml parser, it could not work with files bigger than 10 mb.
This could be solved by reading the SVG images in chunks, like here, but it is still not implemented. I tried to do it in my own way, but no luck, is there somebody who tried to fix this?
My code:
$fopen = fopen($svgdata, "r"); while($fileContents = fread($fopen, 102410245)) { if (!xml_parse($parser, $fileContents, feof($fopen))) { $error_message = sprintf('SVG Error : %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); $this->Error($error_message); } }
FIY: $svgdata is now the path to the SVG file.
Thank you.