Skip to main content
1-Visitor
March 7, 2019
Question

How to extract the image attachment and display in html?

  • March 7, 2019
  • 1 reply
  • 2428 views

I am trying to extract an image from the Document workflow. (See attached)

 

The respective jsp file code for this is :

   ArrayList attachement = (ArrayList) getFieldValue (cmdRunner, childId, "Text Attachments");
   if (attachement != null && attachement.size () > 0) {
    if (text.length () > 0) {
     text += "<br>";
    }
    text = text + "<b>&lt;&lt;Attachment&gt;&gt;</b>"; // This line seem in correct.

 

Any body know how to extract the image ?

Appreciate your help.

 


      
   
   

1 reply

5-Regular Member
March 7, 2019

Do you need to download the image, or just add a link to it? 

For a link, you need to know the Attachment field ID (in this case the ID for "Text Attachments" which you can get by running im fields --fields=id,name "Text Attachments"). ), the attachment name, and the item number:

 

http://servername:port/im/viewattachment?issue=itemid&attachment=attachmentname&fieldID=attachmentfieldID

 

To get the attachment name, use getAttachments("Text Attachments") to get an array of the attachment names.

 

If you need to download the image, then you need to use the attachment bean: getAttachmentBeans("Text Attachments")

From the attachment bean, you can get the contents of the attachment using getContent(java.io.OutputStream out).

acheong1-VisitorAuthor
1-Visitor
March 11, 2019

Dear awalsh,

Thanks very much for the help.

I still working on it, I will update again regarding the outcome.

 

Thanks verymuch

Andy