Hi,
Is it (still) possbile to retrieve the image from a DB and place it into the docx document without creating first a file into the file system?
We are currently trying to upgrade to phptodocx 4.1 but images causes us quite a headache.
In 3.7 we were able to retrieve images (photos) directly from the db and place them on the docx.
But with 4.1. our code below does not work anymore.
Please, could you please give us a hint what to do?
// $photos array is retrieved from the database
foreach ($photos as $photo) {
$imageElement = addImage($photo, true, $this->imageSize);
$col1['value'] = createWordMLFragment(array($imageElement));
$col2['value'] = ...
$imageTable[] = array($col1, $col2); // The MS word table will have images per table row
addTable($imageTable, $imageTableProperties, $imageRowProperties);
....
In 4.1 documentation there are plenty of examples for handling image file from the file system.
When testing with image files all other parts of our code works OK. For us it would be much more convenient to retrieve images directly from database.
$photo = 'photo1.jpg'
$paramsImg = array(
'src' => $photo, ...... (other parameters));
$imageFragment = new WordFragment($this->document);
$imageFragment->addImage($paramsImg);
..