-
Notifications
You must be signed in to change notification settings - Fork 529
Powerpoint 2007 & ODPresentation Readers: Loading embedded media + media loading from disk #849
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
base: master
Are you sure you want to change the base?
Powerpoint 2007 & ODPresentation Readers: Loading embedded media + media loading from disk #849
Conversation
…Image signature Fixed embed shape name to use just the filename
A presentation may have a label for the file (e.g. Media file 1), which differs from the actual file name (foobar.mp4)
@@ -791,7 +793,11 @@ protected function loadShapeDrawing(XMLReader $document, DOMElement $node, Abstr | |||
{ | |||
// Core | |||
$document->registerNamespace('asvg', 'http://schemas.microsoft.com/office/drawing/2016/SVG/main'); | |||
if ($document->getElement('p:blipFill/a:blip/a:extLst/a:ext/asvg:svgBlip', $node)) { | |||
$embedNode = $document->getElements("p:nvPicPr/p:nvPr//*[local-name()='media']", $node); | |||
$embedNode = $embedNode ? $embedNode->item(0) : false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PHP Static Analysis (7.1)
error doesn't look correct.
Ternary operator condition is always true.
$document->getElements()
likely invokes and returns the result of DOMXPath::query
, thus $embedNode
may have a value of false
:
If the expression is malformed or the contextNode is invalid, DOMXPath::query() returns false.
Description
Motivation
I work on behalf of an e-Learning authoring tool. We are adding powerpoint import as an option for client learning designers to quickly import proprietary information into their course designs.
We wanted to add support for importing the following data from a powerpoint:
I noticed that, although text and images were being loaded, there were no signs of embedded files. This PR aims to ameliorate that.
Changes
PowerPoint2007::loadShapeDrawingImage
I tried not to deviate too far from existing code norms, and didn't over-optimise by refactoring common bits between loading shapes.
Limitations
Not sure where to start for Powerpoint 97 (PPT) formats. 🤔
Observations
The (untouched) parent classes of
Media
andFile
look very biased to images.Checklist: