2016-11-23 21 views
0

我已經經歷了很多類似的問題,我無法找到我的問題的答案。SimpleXMLElement在600dpi背景下返回null

我有一個svg image。我試圖通過使用SimpleXMLElement從它獲取內容。

$svgimage = path to svg image; 
    $svgString=file_get_contents($svgimage) ;//returns image  

    $svg = new SimpleXMLElement($svgString);//returns nothing 

我一直在使用300dpi圖像爲SVG的背景image.Now我改成了600dpi。之後$svg回報nothing.I不知道爲什麼的SimpleXMLElement不能在600dpi的工作。

Error Log
Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : AttValue length too long

Warning: SimpleXMLElement::__construct():
xlink:href="data:image/x-ms-bmp;base64,Qk1mDokAAAAAADYAAAAoAAAAZQgAAHEFAAAB

Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : attributes construct error

Warning: SimpleXMLElement::__construct(): Entity: line 29: parser error : Couldn't find end of Start Tag image line 20

Warning: SimpleXMLElement::__construct(): Entity: line 709: parser error : internal error: Huge input lookup

Warning: SimpleXMLElement::__construct():
name="order-id"

Size of SVG is 12MB 

任何形式的幫助,將不勝感激。

+0

是否有任何錯誤/異常顯示或寫入錯誤日誌? SVG文件有多大?你可能會達到'memory_limit'與600 dpi(只是瘋狂的猜測)。 –

+0

我已更新我的問題。 – NID

回答

0

最後我解決了這個問題。

simplexml_load_string($xml, 'SimpleXMLElement', LIBXML_COMPACT | LIBXML_PARSEHUGE) 

LIBXML_PARSEHUGE是它!我不知道如何,但是我很早就錯過了。