OpenClinica User Manual/ShowingAnImage

=Showing an image file=

Introduction
OpenClinica allows us to upload a file to the system. This file is only accessible through a link, it is not shown on the page. In this how-to we will see how we can show image files automatically.

Where to store the uploaded files
In datainfo.properties there is an attribute called 'attached_file_location'. This specifies where the uploaded files will be stored on the server. If we leave this item blank the default location will be used: /usr/local/tomcat/.data/.

Challenge with default upload location
The default upload location is not in the root of the OpenClinica web application. Tomcat can therefore not access it, when we use a tag. There are two ways around this.
 * 1) Change the default location
 * 2) Use a reverse proxy to serve images

Change the default location
When we want to store files in a place that is visible to Tomcat we change the line in datainfo.properties to: Don't forget to change the  placeholder into something meaningful for your system.

Use a reverse proxy to serve images
Use OpenClinica_User_Manual/UsingAReverseProxy to install Nginx as a reverse proxy. Add this line to the https server configuration of Nginx Now images will be served directly by Nginx. If you use a lot of images, this is the preferred configuration.

Code to add to the Excel CRF definition
Read OpenClinica_User_Manual/StylingWithJQuery for a better understanding of the code below. Put the code in LEFT_ITEM_TEXT. The picture will be inserted before the standard buttons for replacing or removing a file. The picture is not immediately visible. It will be shown after you save the page and reopen it again.