Advanced Techniques - MIME types and file icons
If special files are saved and provided for download in a portal, a standard icon
for unknown file types will be displayed. Files, such as from CAD programs,
are not included in the standard lists. This workshop demonstrates how the
media types in Intrexx can be extended. The corresponding file
icon will then be displayed and the file will be opened in the corresponding
application when it is selected in the browser.
To extend the media types in Intrexx, please proceed as follows:
1. Extend mimemap-custom.xml
This file can be found in the
portal directory internal/cfg.
Custom definitions for media types can be added to this file. The following
pattern is used for this:
<entry extension="file extension" mimetype="MIME type"/>
An Autocad file, which has the .dwg type, requires the following entry:
<entry extension="dwg" mimetype="application/acad"/>
An interesting source to help define MIME types is available
here.
2. Icons for additional file types
The icons, which Intrexx displays in download controls, are stored in the
portal directory external/htmlroot/images/assets/filewalker/ext.
The following pattern is used to name these:
<file extensions>.gif
Therefore, Autocad files would be named as follows:
dwg.gif
The files can also have the .png or .jpg format. The assignment table
in step 3 needs to be defined accordingly to achieve this. Larger images are
more ideal for tablets and smartphones as these need to be pressed with
a finger.
Sources for alternative icon files
https://365webresources.com/10-flat-filedocument-type-icon-sets-free-download
https://www.freecreatives.com/icons/file-type-icons.html
3. Assign MIME types to the icon files
The file extensions can be assigned to the icon files in the file
fileextension.properties in the
portal directory internal/cfg.
The pattern for this is
<file extension>=images/assets/filewalker/ext/<file extension>.gif
Example
dwg=images/assets/filewalker/ext/dwg.gif
The file format can also be .png or .jpg, if the file in the icon
directory has the corresponding format.
4. Restart the portal service
Finally, restart the
portal service.