yllen / pdf

GNU Affero General Public License v3.0
14 stars 15 forks source link

TCPDF ERROR: [Image] Unable to get the size of the image when trying to export a ticket to PDF #21

Closed EusebioGM closed 1 year ago

EusebioGM commented 2 years ago

BUG DESCRIPTION

"PDF PRINT: TCPDF ERROR: [Image] Unable to get the size of the image: https://localhost/glpi/plugins/pdf/front/export.php"

Hi support team, i have an issue with the lastest pdf plugin (2.1.0) with GLPI 10.0.1 (downloaded from "https://plugins.glpi-project.org/#/plugin/pdf" ) when trying to export a ticket to PDF.

IMPORTANT: It only occurs when "Ticket" has attached images, or emails on it--> If I try to generate a PDF file from a ticket that has no e-mails/images attached, the plugin works fine.

image

Could you please help me with this issue, please? I can sent you logs if you tell me the name of lof file, paths, commands to execute (if necessary) I remember when I was working with GLPI v9.5 (and pdf v2.0) it worked fine. An it was fantastic!

CLARIFICATION: I had the SAME problem since I updated to GLPI v10.0.0 with the lastest "pdf plugin (2.1.0)" In other words, the problem already existed with GLPI v10.0.0 with "pdf plugin (2.1.0)"

So, I tried to update to GLPI v10.0.1 to see if the upgrade to the latest version coud fix that problem with the plugin, but the problem persists. The PDF conversion plugin is a really fantastic plugin when it is working fine. I would strongly appreciate it if you could help me solve with this issue.

Thanks in advance!

yllen commented 2 years ago

The system change in GLPI since 10.0.0. Can you test my solution and confirm it's OK for you?

EusebioGM commented 2 years ago

Hi Yllen,

Thanks a lot for your post. I have just applied the fix and I think we have had some progress with your solution. Now I have detected two different CASES depending on the tickets that have images embedded inside the ticket:

CASE 1) The pdf convertion works (in same tickets with several images embedded): But when it works the images in the pdf file are not displayed (same than "https://github.com/yllen/pdf/issues/19"; so maybe this issue was solved for glpi 95 but still not solved for GLPI10.0.1 with "pdf plugin 2.1.0").

CASE 2) The pdf convertion does not work in other tickets (with several images embedded): It keeps the same error format as you can see in the following picture:

image

I copy the error message: "TCPDF ERROR: [Image] Unable to get the size of the image: https://if-of-glpi/glpi/front/document.send.php?docid=1713&tickets_id=373"

Could you please help me? Thanks a lot,

yllen commented 2 years ago

In GLPI10, documents are not saved in the database as in GLPI95 and i don't find a script to change this. So, i need more information:

EusebioGM commented 2 years ago

Thanks a lot for your answer: Here you have my screenshots:

Let me know If If you need more information on my side. Thanks a lot!!

yllen commented 2 years ago

I need the result of content column for your issue not the description of the column in database (you must have something like <p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUh.....)

EusebioGM commented 2 years ago

Ok, Thanks a lot!! Here you have the content column for CASE1 :

<p>SMG envia este correo (<a href="https://ip-of-glpi/glpi/front/document.send.php?docid=2342&amp;tickets_id=477" target="_blank" rel="noopener">Depuración de reglas.msg</a>) tras la reunión con Dgo, Hg, Pedri y yo.</p><p>**</p><p>Hola a todos,</p><p>Como todos sabéis, desde hace tiempo venimos arrastrando una serie de “prácticas” (por decirlo de alguna manera), a la hora de implementar reglas.</p><p>Esto quedó de nuevo a la vista cuando vimos vía Teams el asunto de incluir los nuevos equipos en el grupo “Estaciones1”, etc …</p><p>Para poner remedio a este problema, es necesario revisar y depurar todas las políticas que aplican, etc</p><p>Si os parece bien, vamos a comenzar a depurar las políticas que afectan a un grupo; aquí he filtrado las reglas donde existe un “valor” en el campo “Services & Applications” (el firewall deja pasar los puertos) , y os lo adjunto en un Excel (<a href="https://ip-of-glpi/glpi/front/document.send.php?docid=2341&amp;tickets_id=477" target="_blank" rel="noopener">20220404_fase1_reglas.xlsx</a>).</p><p>En el excel veréis estas reglas con varios colores de fondo, en función de si la depuración de las reglas corresponde en principio a equipo1 (fondo azul), a equipo2 (fondo verde), o a equipo3 (fondo salmón) .</p><p>La idea es que cada departamento revise los puertos que han de ir asociados a sus reglas correspondientes, y una vez identificados, hagáis una petición por la otra herramienta, para ir poco a poco dejando las reglas como deben estar (con los puertos finales).</p><p>Una vez tengamos esto depurado, continuaremos por ejemplo con las reglas que tienen como destino = valor, e iremos así sucesivamente depurando, hasta dejar las reglas en un estado coherente.</p><p>Si tenéis alguna duda o comentario, podemos tener una reunión por Teams.</p><p>Un saludo,</p><p>Serio</p><p>**</p>

yllen commented 2 years ago

can you post the content for ticket ID 373?

yllen commented 2 years ago

In your example, you have a link to a picture of a ticket not and url to display the picture. To display the picture i need and img tag with src reference

yllen commented 2 years ago

Trying with your ticket's content

EusebioGM commented 2 years ago

can you post the content for ticket ID 373?

Here you have the "Content (ID 373)":

<p>Servidor ePO bloquea los propios proceso de McAfee</p><p>Existe un BUG y un script "bat" para instalar un certificado propio de McAfee que evita que los propios productos de McAfee se bloquéen por el mismo VSE</p><p><a href="https://kc.mcafee.com/corporate/index?page=content&amp;id=KB12345"&gt;https://kc.mcafee.com/corporate/index?page=content&amp;id=KB12345&lt;/a&gt;&lt;/p&gt;&lt;p&gt; </p><p><a href="https://x.x.x.x/glpi/front/document.send.php?docid=1705&amp;tickets_id=373" target="_blank" rel="noopener"><img src="https://x.x.x.x/glpi/front/document.send.php?docid=1705&amp;tickets_id=373" alt="ca2881ed-d9d62df8-619e65587ea463.90223236" width="649" /></a></p>

yllen commented 2 years ago

I need the content of the database for ticket 373 to have the glpi html encodage. In the database all tag html are encoded so you never have < character

EusebioGM commented 2 years ago

Hi Yllen, I do not know if I understand you correctly. Here you have ALL the contents fields of the Ticket 373 (This is the HEADER of the ticket):

'373', '0', 'Servidor bloquea los propios procesos, '2021-11-08 15:38:50', NULL, NULL, '2022-03-14 18:10:27', '6', '4', '6', '0', '<p>Servidor ePO bloquea los propios proceso de McAfee</p><p>Existe un BUG y un script \"bat\" para instalar un certificado propio de que evita que los propios productos se bloquéen por el mismo </p><p><a href=\"https://kc.web.com/corporate/index?page=content&amp;id=KB12345\"&gt;https://kc.ewb.com/corporate/index?page=content&amp;id=KB12345&lt;/a&gt;&lt;/p&gt;&lt;p&gt; </p><p><a href=\"https://x.x.x.x/glpi/front/document.send.php?docid=1705&amp;tickets_id=373\" target=\"_blank\" rel=\"noopener\"><img src=\"https://x.x.x.x/glpi/front/document.send.php?docid=1705&amp;tickets_id=373\" alt=\"ca2881ed-d9d62df8-619e65587ea463.90223236\" width=\"649\" /></a></p>', '3', '3', '3', '0', '1', '1', '0', '0', '0', NULL, NULL, '2022-03-14 18:10:27', '0', '0', '0', '0', '0', NULL, NULL, NULL, '618106', '0', '0', '1', '0', '0', '11', '0', '2021-11-08 15:38:50'

Additionally, here you have a picture about the 5 rows (FollowUps) from the same ticket ID. image

(I can not sent you "here" the total content of the rows because their content. Anyway, if you need the content, instead of the picture, you can tell me how to send them to you as a private message.)

Thanks a lot!

yllen commented 2 years ago

I don't understand why only a part of the ticket's content in encoded. The picture is displayed in the ticket's content in glpi?

EusebioGM commented 2 years ago

I have several pics. One picture is included in the ticket HEADER (first one with green colour in the background). The other ones are in the FollowUps ot the ticket (second picture "with a lot of characters" in gray colour) image

Additionally, you can see more pics in the next FollowUps ot the ticket (as well in gray colour).

image

The last picture in my previous image (the only one in the form of a table and with sequential dates), is the one that leads us to the error when I try to export the whole ticket (HEADER and content/FollowUps) to pdf with the error you already know: "TCPDF ERROR: [Image] Unable to get the size of the image: https://if-of-glpi/glpi/front/document.send.php?docid=1713&tickets_id=373"

yllen commented 2 years ago

sent me

EusebioGM commented 2 years ago

I have sent the email withe info. you requested to glpi@ll-experts.com Thanks a lot!!

stdglpi commented 1 year ago

Hello all, I follow this issue because I have installed the plugin et i'm on GLPI 10.0.2 When i want to export the ticket I have the same error.

image

cedrobert commented 1 year ago

Hello, I have the same issue with GLPI 9.5.9 and PDF 2.0.1

cedrobert commented 1 year ago

thank it's OK for me. In GLPI 9.5 and PDF 2.0.1 with this changes.

stdglpi commented 1 year ago

On GLPI 10.0.3 after modified theses two files :

the error still occurs

yllen commented 1 year ago

Mail received from Eusebio

I have replaced my current php files for the new ones you sent me in your last email: "itilfollowup.class.php and ticket.class.php" and then I refresh "Google Chrome Web Explorer" And I have seen that it work!! PDF conversions are beeing done correctly!