Quantcast
Channel: PHPWord
Viewing all articles
Browse latest Browse all 450

Commented Issue: How to add image from url? [52]

$
0
0

Hello!

I try add image from my site (http://mysite/image.php).
code:

```
<?php
require_once '../PHPWord.php';
$PHPWord = new PHPWord();
$section = $PHPWord->createSection();
$section->addMemoryImage('http://mysite/image.php');//<---
$objWriter = PHPWord_IOFactory::createWriter($PHPWord, 'Word2007');
$objWriter->save('Image.docx');
?>

```

___Fatal error: Uncaught exception 'Exception' with message 'Could not close zip file Image.docx.' in /PHPWord_0.6.2_Beta/PHPWord/Writer/Word2007.php:158
Stack trace: #0 /PHPWord_0.6.2_Beta/Examples/Image.php(36):
PHPWord_Writer_Word2007->save('Image.docx') #1 {main} thrown in/PHPWord_0.6.2_Beta/PHPWord/Writer/Word2007.php on line 158___

When I use: __$section->addImage('image.jpg');__ script it works.

Can you help me please.
Thanks for your answer.
Comments: Well I'm having the same problem . Seems like the only possibility is to download the file using curl, put it on a temp folder a add it to the zip, witch is totally useless and unsafe. Any updates, please let me know

Viewing all articles
Browse latest Browse all 450

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>