I have a file that allows me to make modifications to a MySQL registry which includes adding an image. When I try to send the data to another file to make a PDF I do not recognize the image, it recognizes the path "images / imag1.png".
This is a fragment of the Modification.php code that allows me to store the image in the database.
if($_FILES["archivo"]["error"] > 0){ //Archivo Modificacion.php
} else {
$nom_archivo = $_FILES['archivo']['name'];
$ruta = "../imagenes/". $nom_archivo;
$archivo = $_FILES['archivo']['tmp_name'];
$subir = move_uploaded_file($archivo, $ruta);
include 'con.php';
echo $sentencia_img="UPDATE ExampleTable SET imagen='$ruta' WHERE id='".$_POST['nID']."' ";
$con->query($sentencia_img) or die ("ERROR al subir imagen".mysqli_error($con));
}
The table in the DB has the column name "image" of type VARCHAR and other columns. Currently I make a query and show the result of what is in that record as
$cons = "SELECT * FROM ExampleTable where id = $nID"; //Archivo MiPDF.php
$sqli=mysqli_query($con, $cons);
while($answ=mysqli_fetch_array($sqli)){
$AllCode.='
<tr>
<td height="100"><strong>Fragment: </strong><br>'.$answ['fragmnt'].'</td>
</tr>
<tr>
<td>Xtra:<img src='.$answ['imagen'].' width="50" ></td>
</tr>';
}
$AllCode.='
</body>
</html>';
$AllCode=utf8_decode($AllCode);
$dompdf=new DOMPDF();
$dompdf->set_paper("A4", "portrait");
$dompdf->load_html($AllCode);
ini_set("memory_limit","128M");
$dompdf->render();
$dompdf->stream("MiPDF.pdf");
In '. $ answ [' image '].' It gives me the path where the image is saved, and what I need is for me to show the image.