Mime Type Image Macro

Last modified by Vincent Massol on 2021/03/17 21:34

cogDisplays an icon for a variety of common mime types and file name extensions
TypeDoc (Velocity Macro)
Category
Developed by

XWiki Development Team

Rating
0 Votes
LicenseGNU Lesser General Public License 2.1
Bundled With

XWiki Standard

Description

Supported filename extensions:

  • images
  • office documents
  • various other types of files

Usage

#mimetypeimg($mimetype $filename)

Parameters definition

NameOptionalAllowed valuesDescription
mimetypenoa stringmime type, i.e., of an attachment
filenamenoa stringfilename, 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:

jpg.png

Tags:
    

Get Connected