Integrations and APIs for Service

Get Involved. Join the Conversation.


    Lautaro Illescas
    Add an image to a report in a custom process
    Topic posted December 5, 2018 by Lautaro IllescasGreen Ribbon: 100+ Points, tagged Connect PHP, Custom Process Models - CPMs 
    114 Views, 4 Comments
    Add an image to a report in a custom process


    We have to execute a report from a custom process, and add to it a signature, wich is received as a PNG from another system. Then send it by mail as an attachment.

     From what we understand, we can easily execute the report from PHP, and we can also easily send it by mail. The problem is that we can't add the bytes of the signature to the report.

    We tried to replace the image dynamically from the report, but we had no success. We also tried to get a report with images from SOAP and REST, to tried to replace it, but we also had no sucess. Is it possible to make an image of the report and overlap the image of the signature? We tried this but we coudn't do it.

    We are open to ideas/suggestions.

    Please let me know if this is possible,




    • Vlad

      Hey Lautaro,

      You are right, you can run a report in Connect PHP and also send an email in Connect PHP using the Public Mail API.
      I am not sure I understand the signature part, could you expand on that? Try not to assume anything and dumb it down for us as much as you can :)


      • Lautaro Illescas

        Hello Vlad, thanks for your answer.

        We have an object that will receive the bynary data of a signature from another system. This will trigger our custom process, and it's expected from OSvC to execute a report, wich contains fields from an incident. 

        With this we need to add the PNG that we received to the report, then make it a PDF and send it by mail.

        We didn't find a way OOTB to make the image dynamic on the report, for example, to show an attachment as an image on the report, so we could replace that attachment and simply execute the report and send the mail. We also tried to use PHP libraries to accomplish this, but we couldn't use them as OSvC blocked it,

        I will attach two screenshots.



        Report.png (73KB)
    • Vlad

      I don't have any experience with images embedded in reports but I don't think there's a way of changing them dynamically from the console or from connect PHP.

      You can use the Public Mail API to send emails and you can add images to the message body, through HTML. So maybe you can have the CPM run the report, create a MailMessage object, place the report results in a table in the MailMessage.Body.Html field and add the image to this same field after the report results, in HTML form. If you want the image to be retrieved dynamically from an attachment, I think you can do that too. You can fetch the file attachment base 64 data and add it to an <img> HTML element in the MailMessage, something like this:

      $html = "Report data..." . "<img src=\"data:image/png;base64, " . $incident->FileAttachments[0]->Data . "\" />";

      I have not tested this, you may want to experiment a bit further.

      • Lautaro Illescas

        I also suggested this, but they want a PDF as an attachment. 

        But i also think this is the way to go, I tested it using a custom page and opening it locally, and it worked. 

        When i sent it by PHP, the image didnt display correctly.

        I will continue testing this.