I can add images using URL but not trying to get a local image file.
$portada->addImage('earth.jpg');
Getting this error:
Uncaught PHP Exception PhpOffice\PhpWord\Exception\InvalidImageException: "" at C:\Users\kaskull\Desktop\symfony\examsgenerator\vendor\phpoffice\phpword\src\PhpWord\Element\Image.php line 386
I'm createing my Word on a controller so my first idea is that should be something like this:
$portada->addImage('../Resources/Asset/images/logo.png');
Getting the same error.
EDIT:
If i do:
$path = realpath('../Resources/Asset/images/logo.png');var_dump(is_readable($path));
It returns FALSE
But if i use this, it runs.
$path=realpath('C:\Users\CARLES\Desktop\symfony\examsfinal\src\AppBundle\Resources\Asset\images\logo.png');