I have the following situation, in my laravel application that I have been developing, there are two forms, in which I sent images and I keep these in the storage folder of the project, I am trying to insert those images in a word template to which I must add information from the application, using phpword templateprocessor, but I still can not insert the images, I'm trying to do it in the following way:
//Aqui guardo una de las imagenes
$firma=new file(storage_path('firma.jpg'));
// Here I call it and proceed to add the values to the word template:
// Abrimos la plantilla y agregamos informacion a ella usando la libreria php word
$TemplateProcessor= new TemplateProcessor(Storage_path('Estudio_conexion.docx'));
// $TemplateProcessor->setValue('var',$saludo);
$TemplateProcessor->setValue('algoo',$definicion);
$TemplateProcessor->setValue('nombre_cliente' ,$nombre_cli);
$TemplateProcessor->setValue('nombre_empresa' ,$empresa_cli);
$TemplateProcessor->setValue('Correo',$correo_cli);
$TemplateProcessor->setValue('direccion',$direccion_cli);
$TemplateProcessor->setValue('fecha',$fecha_cli);
$TemplateProcessor->setValue('referencia',$referencia_);
$TemplateProcessor->setValue('objetivo',$objetivo_);
$TemplateProcessor->setValue('nom_est',$nombre_proyecto);
$TemplateProcessor->setValue('precio_est','$'.$precio_est);
$TemplateProcessor->setValue('acti1',$act1);
$TemplateProcessor->setValue('acti2',$act2);
$TemplateProcessor->setValue('mtdg' ,$desc_met);
$TemplateProcessor->setValue('firma',$firma);
By adding it in this way, in the word template where you are supposed to insert the image, just insert the address where the image is, try inserting it also using OOXML tags like this:
$imagedata='<v:imagedata w:rel="'.$firma.'" o:title="ejemplo" />';
// Abrimos la plantilla y agregamos informacion a ella usando la libreria php word
$TemplateProcessor= new TemplateProcessor(Storage_path('Estudio_conexion.docx'));
// $TemplateProcessor->setValue('var',$saludo);
$TemplateProcessor->setValue('algoo',$definicion);
$TemplateProcessor->setValue('nombre_cliente' ,$nombre_cli);
$TemplateProcessor->setValue('nombre_empresa' ,$empresa_cli);
$TemplateProcessor->setValue('Correo',$correo_cli);
$TemplateProcessor->setValue('direccion',$direccion_cli);
$TemplateProcessor->setValue('fecha',$fecha_cli);
$TemplateProcessor->setValue('referencia',$referencia_);
$TemplateProcessor->setValue('objetivo',$objetivo_);
$TemplateProcessor->setValue('nom_est',$nombre_proyecto);
$TemplateProcessor->setValue('precio_est','$'.$precio_est);
$TemplateProcessor->setValue('acti1',$act1);
$TemplateProcessor->setValue('acti2',$act2);
$TemplateProcessor->setValue('mtdg' ,$desc_met);
$TemplateProcessor->setValue('firma',$imagedata);
By doing it this way, do not insert anything, even the address, could you give me some idea of how to do this?