Repository navigation
Conversation
Update to version 1.5
geo-fret
marked this pull request as ready for review
July 30, 2025 06:59
oleibman
added a commit
to oleibman/PHPWord
that referenced
this pull request
Dec 9, 2025
Based on PR PHPOffice#2806 by @geo-fret. Fix PHPOffice#2795 (which also requests ico, but geo-fret believes that isn't supported in docx).
Progi1984
reviewed
Sep 24, 2026
Comment on lines
+578
to
+579
| $actualWidth = $svgAttributes->width; | ||
| $actualHeight = $svgAttributes->height; |
Member
There was a problem hiding this comment.
What is the behavior if the width & height are not defined ?
Author
There was a problem hiding this comment.
I've changed the behavior regarding to svg standards
Progi1984
reviewed
Sep 24, 2026
Comment on lines
+765
to
+784
| if (preg_match('/^[+-]?([0-9]+\.?[0-9]*)?(em|ex|%)$/i', $preparedImageAttrs['width'], $matches)) { | ||
| $size = (float) ($matches[1]); | ||
| $unit = $matches[2]; | ||
| switch ($unit) { | ||
| case 'ex': | ||
| $size = $size * 2; | ||
|
|
||
| // no break | ||
| case 'em': | ||
| $width = $size * 152400; | ||
|
|
||
| break; | ||
| case '%': | ||
| $width = Converter::cssToEmu($preparedImageAttrs['originalWidth']) * $size; | ||
|
|
||
| break; | ||
| } | ||
| } else { | ||
| $width = Converter::cssToEmu($preparedImageAttrs['originalWidth']); | ||
| } |
Author
There was a problem hiding this comment.
I moved that part to the converter. Maybe it will need a change here to use the current paragraph font size instead of a fixed one.
Progi1984
reviewed
Sep 24, 2026
Member
There was a problem hiding this comment.
Can you add assertions on presence of tags in XML ?
Author
There was a problem hiding this comment.
I've added just a very small check, if a drawing and a svg tag is in the XML.
Member
|
The CI is 🔴 |
pwsdotru
reviewed
Sep 25, 2026
pwsdotru
reviewed
Sep 25, 2026
pwsdotru
reviewed
Sep 25, 2026
Progi1984
reviewed
Sep 30, 2026
Progi1984
reviewed
Sep 30, 2026
geo-fret
force-pushed
the
feature/template-svg-image
branch
from
December 2, 2026 07:43
33da539 to
09f9362
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Allow svg images to be set through template processor.
Fixes #2795 partly (only svg part)
Checklist: