Skip to content

Feature request: Support EMF image #1480

@bakkan

Description

@bakkan

This is:

  • [√] a bug report
  • [√] a feature request

Expected Behavior

Support EMF image.

Failure Information

Throws PhpOffice\PhpWord\Exception\InvalidImageException exception.
Exception message :
Invalid image: zip:///Users/xxx/Downloads/xxxx.docx#word/media/image.emf
#0 /works/shared/laravel/vendor/phpoffice/phpword/src/PhpWord/Element/Image.php(149): PhpOffice\PhpWord\Element\Image->checkImage()
#1 [internal function]: PhpOffice\PhpWord\Element\Image->__construct('zip:///Users/hu...', NULL, false, 'Picture 18')

How to Reproduce

Document file contains emf format images.
Google emf I got this page: https://fileinfo.com/extension/emf

<?php
use PhpOffice\PhpWord\IOFactory;
$file = '/path/to/file.docx';
$phpWord = IOFactory::load($file);
$sections = $phpWord->getSections();
foreach ($sections as $section) {
      $elements = $section->getElements();
      foreach ($elements as $element) {
            // do something else...
      }
}

Context

  • PHP version: PHP 7.1.16
  • PHPWord version: 0.15.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions