Image not found or type unknown

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • carlosptf
    Junior Member
    • Jul 2024
    • 28

    Image not found or type unknown

    Hello everyone,

    I’m facing an issue with PDF templates in EspoCRM. I can create the template normally and add images in PNG or JPG format without any problems. However, when generating the PDF, the images are not displayed, and I encounter different issues depending on the PDF engine:
    • Dompdf: displays the message: “Image not found or type unknown”.
    • TCPDF: leaves a blank space where the image should be.

    I’ve tried some alternatives:
    • Uploading the image directly and linking to an image URL, but the result is the same.
    • Checked EspoCRM logs and couldn’t find any errors related to this issue (at least in the places I looked).

    Has anyone experienced this or has any ideas on how to solve it?

    Click image for larger version

Name:	CleanShot 2025-01-08 at 17.54.03@2x.png
Views:	12
Size:	41.5 KB
ID:	113681
    Click image for larger version

Name:	CleanShot 2025-01-08 at 17.54.15@2x.png
Views:	10
Size:	235.5 KB
ID:	113682
    Click image for larger version

Name:	CleanShot 2025-01-08 at 17.54.53@2x.png
Views:	10
Size:	50.8 KB
ID:	113683
  • victor
    Active Community Member
    • Aug 2022
    • 743

    #2
    I can't reproduce. Please send the original image you use and export your template (and send it too).

    Click image for larger version

Name:	image.png
Views:	3
Size:	27.5 KB
ID:	113688

    Comment

    • carlosptf
      Junior Member
      • Jul 2024
      • 28

      #3

      Hello everyone,

      I’ve identified the cause of the issue with images not displaying in PDF templates. Here’s what I discovered:
      I created the file:

      custom/Espo/Custom/Resources/metadata/app/recordId.json

      with the content:

      {"type": "uuid4", "length": 36}

      This setup followed a tutorial I found:

      Using UUIDs as IDs in EspoCRM: Learn how to improve data security and avoid ID collisions with UUIDs. Switching to UUIDs made easy with professional IT services.


      After making this change, the image code in the template looked like this:

      <p><img src="?entryPoint=attachment&amp;id=d9c2fde0-68ee-4e55-8421-f2870fbc9e92" style="width: 143px;"><br><br>777<br><br></p>

      When generating the PDF, this caused the error: “Image not found or type unknown” to appear instead of the image.


      By removing the custom recordId.json file and reverting to EspoCRM’s default way of handling IDs, the image code changed to this:

      <p><img src="?entryPoint=attachment&amp;id=677f252139bd32c 22" style="width: 143px;"><br></p>


      This resolved the issue, and the error disappeared.

      It seems there might be a bug in EspoCRM when handling IDs in the UUID version 4 format. Has anyone else encountered this, or should this be reported to the development team?

      I already have a considerable number of records using UUID4 as the ID format. Would it cause any issues if I simply disable this configuration due to the PDF generation error?

      Alternatively, is there a way to resolve the issue without having to disable the use of UUID4 IDs altogether?

      Last edited by carlosptf; Today, 01:41 AM.

      Comment

      Working...