Hi.

I am trying to display an image in the pdf template that is generated when printing a ticket.
If, for example, the "src" property of the "<img>" tag is informed with a relative path, the image does appear in the pdf.
Example: <img src="/images/image01.jpg" alt="Imagen del producto" style="max-height:480px;">

But if the "src" property is informed with the path used to access the attached files, then the image is not loaded into the pdf.
Example: <img src="/file.php?key=_rwmxdkezhjizx7bvjlyweuvgz09vlhk&expires=1611187200&signature=3d9c8be1bb7a7771dcb1980ced47c3e7e46138e1" alt="Imagen del producto" style="max-height:480px;">
These urls are obtained when we collect the value of the attached files of a form.

I don't quite understand why the second example doesn't work. This url, if we use it in a browser, returns an image element, and this element indicates the same url in its own "src" attribute. (Screenshot_1.png)

What am I doing wrong? How could I make the attached images of a ticket appear in the report pdf?

Thanks a lot.

Server Info:
Versión osTicket v1.12 (a076918)
Servidor del Software Web nginx/1.16.1
Versión MySQL 5.7.32
Versión PHP 7.0.33

    BrunoSF <img src="/images/image01.jpg" alt="Imagen del producto" style="max-height:480px;">

    This is pointing to a static file.

    BrunoSF <img src="/file.php?key=_rwmxdkezhjizx7bvjlyweuvgz09vlhk&expires=1611187200&signature=3d9c8be1bb7a7771dcb1980ced47c3e7e46138e1" alt="Imagen del producto" style="max-height:480px;">

    This is pointing to a PHP file, that should in essence do a DB lookup to find the file, and return it.

    My guess is that the it is either not being done (more likely), or not being done in time to generate the pdf. One is handing a file, one is trying to trigger another process. I haven't looked at the rest of the export code, but I imagine that it wants a file, not a script to give it a file. you can test this theory by having it save the result of the second to a file, and then add it to the pdf.

      ntozier Hi. Thank you very much for the reply. I have also tried using a sleep (), but it can't load anything. I think the reason is that when using that type of uri ('file.php? ...') in the src property, no request is made to the server and nothing is retrieved. I think that by making a request using 'curl', the response from the server could be retrieved and then extracting the '<img>' element. Anyway, if anyone knows a better method, let us know.

      Write a Reply...