Announcement

Collapse
No announcement yet.

System Template Images

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

  • System Template Images

    I'm trying to add an image to the "Password Change Link" message but HtmlIzer.php seems to be taking any urls like ?endPoint=attachment and changes them to a broken link of the form:
    src="data/upload/..." is this by design? Also the login seems to get triggered when $this->entityManager !=null which seems true all the time?

    Am i missing something here? How do a get an image into the email? Is the only way to have a none ?endpoint based image?
    Thanks

  • #2
    "Also the login seems" = "Also the LOGIC seems"

    Comment


    • #3
      It appears that Htmlizer is doing 2 things:
      1. changing ?entryPoint=attachment&amp to ?entryPoint=attachment&
      2. changing ?entryPoint=attachment&id=xyz to data/upload/xyz

      I ended up creating my own HtmlizerFactory to load my own Htmlizer using binding.php

      Then when htmlizer->render is called I call parent->render and then undo the changes by replacing data/upload/ with ?entryPoint=attachment&amp

      The in subsequent processing by sender.php line 559 looks for ?entryPoint=attachment&amp adn converts these to inline attachments for the email.

      Net result.....image embedded in email

      Comment


      • #4
        Will be fixed. Thanks.

        Comment


        • czcpf
          czcpf commented
          Editing a comment
          What is the purpose of this conversion in a system template ? What would be the proper way to use ?entryPoint=attachment&id={} in the html template code so an attachment does get attached to a system email. I'm assuming that was the purpose behind this code in HtmlizerFactory no?

        • czcpf
          czcpf commented
          Editing a comment
          Which release fixes this?

      • #5
        but...probably breaks something else

        Comment


        • #6
          murray99 , I looked into this. It seems like the code your reference in htmlizer.php has not been changed up to the latest release so I assume this problem still exists there. I'm using Espo 7.4.5 and see it. What I did to solve this was much simpler:

          Here is a snippet of my systemTemplate:

          HTML Code:
          <img src="?entryPoint=attachment&amp;id=64b5b5e0a35728d31" style="width: 100px;">
          Here is a php snippet from where I send the email

          PHP Code:
          $body $htmlizer->render(
          $entity,
          $bodyTpl,
          '',
          $data,
          false//skip links
          true //skip inline attachment handling IMPORTANT
          );‚Äč 

          If you do not skip inline attachment handling it will replace the entryPoint bit with the absolute file path of the attachment which causes the problem. If you simply 'skip' this by setting the parameter to true, ESPO will appropriately embed the image in the body of the email by base encoding it based on the mime type.

          This happens in



          and



          Where it looks for
          PHP Code:
          ?entryPoint=attachment&amp;id={$id
          I guess when this eventually gets fixed the code above will break and one would have to go back and change it to false.
          Last edited by czcpf; 07-19-2023, 07:44 PM.

          Comment

          Working...
          X