REDCap: Inline Image and Documents
Within REDCap you are able to display certain images, PDFs, or uploaded files (uploaded to file upload fields) inline on a page. This feature works for forms, surveys, and emails.
@INLINE & @INLINE-PREVIEW Action Tags
For a full list of REDCap action tags, and instructions on how to use them, see Action Tags in REDCap.
The @INLINE action tag allows a PDF file or image file that is uploaded to a File Upload field to be displayed in an inline manner on the survey page or data entry form. The PDF file or image can be viewed on the page by the user or survey participant without having to download it.
This action tag works for certain image types (JPG, JPEG, GIF, PNG, TIF, BMP) and PDF files.
The @INLINE-PREVIEW action tag allows a PDF file or image file that is uploaded to a File Upload field or into a Descriptive Field to be previewed by the user or survey participant viewing the form. This action tag adds a "Preview" button that can be toggled to view the recently uploaded field without the need to download it to your device.
Tips and tricks for using the @INLINE action tag:
- The PDF/image will be displayed inline on the page immediately above the download link for the field.
- The PDF will be displayed with 100% width by default. This means it will fill up to 100% of the width of the space it is contained in.
- Images will be displayed with their native width:height ratio. PDFs will be displayed with a 300 pixel height by default.
- If you wish to manually set the width and/or height of the image/PDF, you may put the width/height values inside parentheses after the action tag in the following manner:
- @INLINE(width)
- @INLINE(width,height).
- The @INLINE action tag also works if the File Upload field is embedded inside another field on the page.
- Note: When adjusting the size of inline display for a file upload field, keep in mind that the display may be constrained by other design elements on the page.
- Note: Inline images are not able to be displayed inside a downloaded PDF of a survey/instrument that contains data
Inline Piping
You can also pipe an uploaded image or file inline using the ":inline" piping parameter. You may pipe an uploaded image or file into another field or into an email.
To use inline piping, append ":inline" to the name the piped file upload field, such as [my_field:inline]. If the uploaded file is a PDF file or image file (JPG, JPEG, GIF, PNG, TIF, BMP), the file will be displayed in an inline manner so that it is viewable on the page.
The ':inline' option DOES work inside emails, so you can pipe a field with ':inline' inside the email body. This allows you to display inline images inside survey invitations or Alerts & Notifications.