Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.

Moderator: amosbatto

Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
#826289
I have been trying to find a way to do this for DAYS!!!

Someone please help, the below gets me as far as a link to the URL of the file which I can download but I want to use this as the image source in the output document so it displays as an image.

trigger to get file url:
Code: Select all
$caseid = @=APPLICATION;

$query3 = "SELECT APP_DOC_UID, DOC_VERSION FROM APP_DOCUMENT WHERE APP_UID='$caseid' AND
   APP_DOC_TYPE='INPUT' AND APP_DOC_STATUS='ACTIVE'"; 
$results = executeQuery($query3) or die("Error in query: $query3");

if (is_array($results) and count($results) > 0) {
      $g = new G();
      @@receiptUrl = ($g->is_https() ? 'https://': 'http://') . $_SERVER['HTTP_HOST'] .
         '/sys' . @@SYS_SYS .'/'. @@SYS_LANG .'/'. @@SYS_SKIN . '/cases/cases_ShowDocument?a=' . $results[1]['APP_DOC_UID'] .
         '&v='. $results[1]['DOC_VERSION'];
}

$fullfileurl = @=receiptUrl . ".jpg";
@@fullfileurl = $fullfileurl;
@@panelhtml = '<img src="' . $fullfileurl . '"></img>';
 @@tablehtml = '<table background="' . $fullfileurl . '"><tr><td width="200" height="150"></td></tr></table>';
#826297
First, you need to include the code at the end inside the if clause.

Second, if you are using a recent version of PM, then you need to edit your env.ini file and add:
disable_download_documents_session_validation = 1
See:
https://wiki.processmaker.com/3.2/faq#a ... t_download
https://wiki.processmaker.com/3.2/Confi ... estriction

Third, you need to change from:
$fullfileurl = @=receiptUrl . ".jpg";
To:
$fullfileurl = @=receiptUrl ;
#826310
Thanks - tried the suggestions and no change.

I definitely get the correct URL for the file as I can click the link and download it but I cannot get the <IMG SRC="@=fullfileurl"></img> to display the image.

I did fine that the processmaker editor automatically puts the first part of the URL in which is why I also set the image as a table background but neither show the image still...
#826338
I don't know why it isn't working. I know that <src img="x"> works on my installation of PM (3.3.10 Community in Debian 9.5 with PHP 5.6.37).

Let's do a test. Import this process and run a case in it to see if the images appear in the output document:
https://www.pmusers.com/index.php/Inser ... t_Document

Do the images appear?
#827788
Hello,

Since the web site "https://www.pmusers.com/" is down, can you please share with us the two processes in the links:
1- https://www.pmusers.com/index.php/Display_a_File_field_as_an_image_in_an_Output_Document
2- https://www.pmusers.com/index.php/Insert_grid_with_image_files_in_Output_Document

Can you please attach them in this post?

Kind Regrads.

I recently completed a book on ProcessMaker - &quo[…]

Hi, In https://wiki.processmaker.com/3.0/Report_T[…]

reopen form in the draft

Hi Admin, I use function:onDeleteRow on grid the[…]

Hi, since bugs.processmaker.com in no longer avail[…]