Skip to main content

Displaying image in Oracle APEX Interactive/Classical Report

Solution:

Step 1: Go to shared components and upload required images.

Step 2: Create Interactive/Classical Report.

Step 3: Add below SQL query in source option.

SELECT employees.EMPNO,
  employees.ENAME,
  employees.JOB,
  employees.MGR,
  employees.HIREDATE,
  employees.SAL,
  employees.COMM,
  employees.ONLEAVE,
  employees.NOTES,
  employees.DEPTNO,
  employees.FLEX1,
  employees.FLEX2,
  employees.FLEX3,
  employees.FLEX4,
  employees.RATING,
  employees.GENDER,
  CASE
    WHEN (employees.gender   = 'MALE'
    AND employees.emp_image IS NULL)
    THEN '<img src="#WORKSPACE_IMAGES#not_found_male.jpg" width="75px;" height="75px;"/>' -- Default Male ICON
    WHEN (gender             = 'FEMALE'
    AND employees.emp_image IS NULL)
    THEN '<img src="#WORKSPACE_IMAGES#not_found_female.jpg" width="75px;" height="75px;"/>' -- Default Female ICON
    WHEN employees.emp_image IS NOT NULL
    THEN '<img alt="'
      || apex_escape.html_attribute (employees.ename)
      || '" title="'
      || apex_escape.html_attribute (employees.ename)
      || '" style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '
      || 'src="'
      || apex_util.get_blob_file_src ('P61_EMP_IMAGE', employees.empno)
      || '" height="75" width="75" />'
  END emp_image
FROM emp employees;


Step 3: 

Version below 5.O:

Go to report attributes, make the report column as standard report column.

Version above 4.2:
Go to report attributes, make the escape especial characters = NO. 



Output:






                                                                          

Comments