Mime Type Image Macro
Last modified by Thomas Mortagne on 2026/02/26 15:39
| Displays an icon for a variety of common mime types and file name extensions |
| Type | Doc (Velocity Macro) |
| Category | |
| Developed by | |
| Rating | |
| License | GNU Lesser General Public License 2.1 |
| Bundled With | XWiki Standard |
Table of contents
Description
Supported filename extensions:
- images
- office documents
- various other types of files
Usage
#mimetypeimg($mimetype $filename)Parameters definition
| Name | Optional | Allowed values | Description |
|---|---|---|---|
| mimetype | no | a string | mime type, i.e., of an attachment |
| filename | no | a string | filename, i.e., of an attachment. |
Note : both parameters must be in lower case as the macro does no conversion
Example
#mimetypeimg("image/jpeg" "photo.jpeg")For instance if $attachment is a file attachment:
#mimetypeimg($attachment.getMimeType().toLowerCase() $attachment.getFilename().toLowerCase())Result
For instance for a jpeg file the result will be:
