-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Conversation
@jgpATs2w could you please add test for the new uncovered lines? |
Hi @troosan coverage in Html.php is now 100% |
src/PhpWord/Shared/Html.php
Outdated
|
||
$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'); |
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.
fopen() can return false if it fails to open the file.
see https://scrutinizer-ci.com/g/PHPOffice/PHPWord/inspections/1f0e808d-f874-4a64-9778-f459477f4d58/issues/files/src/PhpWord/Shared/Html.php?status=new&orderField=path&order=asc&honorSelectedPaths=0
Description
Improved parseImage from HTML:
Fixes # (issue)
Checklist:
composer run-script check --timeout=0
and no errors were reportedDon't know how to update the documentation, I've updated the comments ahead the functions.