0

I am working with phpoffice/phpword downloading document as docx. I want to add a remote image for my document passging src as the image url.

https://cdn.pixabay.com/photo/2015/04/23/22/00/tree-736885_960_720.jpg

this is the image url. In my src/PhpWord/Shared/Html.php, there is a condition to check is_file() which check for the given src path.

I am getting always false, then it is returned a "Could not load image" exception. How to fix this issue.

user2552863
  • 483
  • 3
  • 10
  • 18
  • 2
    `is_file()` works only on local paths. It's treating your URL as a local path, and doesn't find a file there (since that's not even a valid file path) – yivi Jan 20 '21 at 10:55
  • https://stackoverflow.com/questions/2280394/how-can-i-check-if-a-url-exists-via-php – Artem Jan 20 '21 at 13:07
  • but for my localhost that image is loading, when I host the system and add url with image then that same image not loading in the server, what could be the reason. there are pdf download option also for the pdf document I am getting the image there fore there isnt a access issue fot the image – user2552863 Jan 20 '21 at 17:30

0 Answers0