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

bug when calling unavailable remote image #1833

Open
simogeo opened this issue Mar 2, 2020 · 3 comments
Open

bug when calling unavailable remote image #1833

simogeo opened this issue Mar 2, 2020 · 3 comments

Comments

@simogeo
Copy link

simogeo commented Mar 2, 2020

Describe the Bug

phpword does not achieve document generation when calling unavailable remote image

Steps to Reproduce

Create html content with unavailable image :

<?php
require __DIR__ . '/vendor/autoload.php';

$phpWord = new \PhpOffice\PhpWord\PhpWord();
$section = $phpWord->addSection();


$content = "<p><img alt="" src="https://www.mydomain/my-unavailable-remote-image" style="height:226px; width:709px" /></p>"

Html::addHtml($section, $content);

Expected Behavior

Should not be blocking but just ignore the image

Current Behavior

phpword does not achieve document generation

Context

Please fill in your environment information:

  • PHP Version: tested on php >= 7.0
  • PHPWord Version: 0.16
@simogeo
Copy link
Author

simogeo commented Apr 3, 2020

@Develog
Copy link

Develog commented Mar 23, 2022

Hi @simogeo !

How did you get around this problem ?
I have the same problem. I need to display my word document even if the src is not working.

@simogeo
Copy link
Author

simogeo commented Mar 23, 2022

I don't really remember how I've managed that ...

But you can use simplehtmldom PHP library to find all images, test them and erase them if you get a 404 error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants