Announcement

Collapse
No announcement yet.

How do I refer to one image id in {{imageIds}} in Template

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • espcrm
    commented on 's reply
    After almost a month, I started using PDF again, and finally manage to get it to work. I am guessing it due to the mod_security issue that I fixed up.

    I can confirm that the code <img style="width: 132.83px; height: 83.95px;" src="?entryPoint=image&amp;id={{landlordSignatureI d}}">
    Work without issue now and finally I can have image in my PDF.

  • espcrm
    commented on 's reply
    I see the <img=src>

    That mean you didn't put that in the code (click the <> button), so right now your template is just a "text" not a code.

  • sandra6012
    replied
    Someone could support me, in my case the image does not appear
    Attached Files

    Leave a comment:


  • espcrm
    commented on 's reply
    It work, I can visibly see the image (I add the company logo by using the image field). But I just can't export that logo using Print PDF/PDF Template

  • telecastg
    replied
    Excellent improvements ! specially the Custom Template Helpers.

    I look forward to 5.8.0 and try to see if "css classes" can be defined as custom template helpers and thus they will be correctly rendered by TCPDF.

    Leave a comment:


  • yurikuzn
    replied
    In the next version it will be possible use imageTag https://github.com/espocrm/documenta...-pdf.md#images

    Leave a comment:


  • telecastg
    replied
    Perhaps you can verify if the image is actually loaded, Espo keeps track of images as "attachments" by creating one attachment record for each file where the record id is the same as the file name.

    The actual file exists in the "data/upload/" folder

    Leave a comment:


  • espcrm
    replied
    Originally posted by telecastg View Post
    I am not familiar with TCPDF errors but I am printing image fields to PDF without a problem using the following code in a template, my image field id is "landlordSignatureId" maybe it can help:

    Code:
    <img style="width: 132.83px; height: 83.95px;" src="?entryPoint=image&amp;id={{landlordSignatureId}}">
    I don't think that the error has to do with the type of image.
    Using your code, I stop getting the error and PDF was able to continue being produced. It weird, I cannot get it to work, it just blank where the code is.

    The field type should be "Image" right? So it correct, without using the image code it produce the #ID string so it can retrieve the code but it cannot display image.

    Then I noticed that I been using the Header section, thinking that is the mistake I tried do same code in the Body but it still didn't work.

    I guess I give this up for now.

    Leave a comment:


  • telecastg
    replied
    I am not familiar with TCPDF errors but I am printing image fields to PDF without a problem using the following code in a template, my image field id is "landlordSignatureId" maybe it can help:

    Code:
    <img style="width: 132.83px; height: 83.95px;" src="?entryPoint=image&amp;id={{landlordSignatureId}}">
    I don't think that the error has to do with the type of image.

    Leave a comment:


  • espcrm
    replied
    Having trouble using this. Just learn about it, I get this error:

    TCPDF ERROR: [Image] Unable to get the size of the image: 5e14147c43d

    Is there a standard type of format of the image that we must use for this to work? This is a .jpg file I'm testing it with. Saved the image from irfanview.

    Leave a comment:


  • telecastg
    replied
    {{file imageId}} means the name of the field (image type) where the image is contained concatenated with the string "Id".


    So for example, if you have an entity with a field type IMAGE named "myImage" the template line should be <img src="myImageId"> and this will display the image.

    Espo stores images as files in the data/upload folder and assigns an ID string to refer to them, so the actual content of the "myImage" field is the ID string assigned by the system to the file.

    The reason why you have to concatenate "Id" to the field name is because the actual mysql table field name is "my_image_id"
    Last edited by telecastg; 05-01-2019, 02:21 AM. Reason: Added explanation about image storage

    Leave a comment:


  • How do I refer to one image id in {{imageIds}} in Template

    I am writing a template and have a quick question that I can find the answer from

    https://www.espocrm.com/documentatio...inting-to-pdf/

    It's possible to print image fields:
    <img src="{{file imageId}}"> where imageId – the name of custom image field, concatenated with the suffix Id.


    when I use the above line it doesn't show any photos, when I use {{imageIds}} it returns 5cbf164eb8f245ae8,5cbf165be263d61e6,5cbf16654f0f60 6d8,5cbf1668e50359b69,5cbf166c60013a7 a3,5cbf187aa2ae037c7,5cbf187ec89466199

    How do I get just the first image id in Template?

    Thanks
Working...
X