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

Add parsing of html image in base64 format #1382

Merged
merged 10 commits into from
May 30, 2018
Merged

Conversation

jgpATs2w
Copy link

@jgpATs2w jgpATs2w commented May 23, 2018

Description

Improved parseImage from HTML:

  • Embedded base64 images
  • Remote files, allowing

Fixes # (issue)

Checklist:

  • I have run composer run-script check --timeout=0 and no errors were reported
  • The new code is covered by unit tests (check build/coverage for coverage report)
  • I have update the documentation to describe the changes
    Don't know how to update the documentation, I've updated the comments ahead the functions.

@troosan
Copy link
Contributor

troosan commented May 23, 2018

@jgpATs2w could you please add test for the new uncovered lines?
https://coveralls.io/builds/17131200/source?filename=src%2FPhpWord%2FShared%2FHtml.php#L659

@jgpATs2w
Copy link
Author

Hi @troosan coverage in Html.php is now 100%

@troosan troosan changed the title html parse images improved Add parsing of html image in base64 format May 24, 2018

$match = array();
preg_match('/data:image\/(\w+);base64,(.+)/', $src, $match);

$src = $imgFile = self::$imgdir . uniqid() . '.' . $match[1];
$src = $imgFile = $tmpDir . uniqid() . '.' . $match[1];

$ifp = fopen($imgFile, 'wb');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@troosan troosan merged commit 1a06173 into PHPOffice:develop May 30, 2018
@troosan troosan added this to the v0.15.0 milestone May 30, 2018
@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 94.899% when pulling e764871 on jgpATs2w:develop into 82f3a2a on PHPOffice:develop.

@troosan troosan mentioned this pull request Jul 9, 2018
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants