Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML image link image not displayed #1589

Open
1 of 3 tasks
charmoller opened this issue Feb 28, 2019 · 3 comments
Open
1 of 3 tasks

HTML image link image not displayed #1589

charmoller opened this issue Feb 28, 2019 · 3 comments

Comments

@charmoller
Copy link

charmoller commented Feb 28, 2019

This is:

Expected Behavior

When converting HTML using Html::addHtml() image links (image nested instead an anchor tag) the resulting Word document should display the image with a link to it.

Current Behavior

When converting HTML using Html::addHtml() image links (image nested instead an anchor tag) aren't working correctly. The resulting Word document is not displaying the image at all.

How to Reproduce

Please provide a code sample that reproduces the issue.

<p><a href="file_link.html"><img src="my-image.jpg" alt="My Image" width="99" height="75" /></p>

Context

  • PHP version: 7.0
  • PHPWord version: 0.14
@GewoonRoy
Copy link

GewoonRoy commented Apr 8, 2019

I got the same issue. Perhaps the information below is useful for a solution.

Additional information:
The image get skipped while parsing the nodes. (File: PHPWord/Shared/Html.php).

The p is parsed and while parsing it updated the $element to an instance of the AbstractContainer. After the a element is being parsed it notice in the parseChildNodes() that $element is an instance of AbstractContainer. The image is skipped which results in an empty file because no value is available within the p nor a element.

Hope it helps.

@deblaci
Copy link

deblaci commented Aug 28, 2019

Is there any workaround for this?

@jayanorangehrmlive
Copy link

I have the same issue could you resolve it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants