MimeTypeImage Macro

This is a Velocity macro, bundled with all the XWiki products by default.
Macro developed by the XWiki Development Team.
This macro cannot currently be downloaded separately.

MimeTypeImage Macro

Displays an icon for a variety of common mime types and file name extensions including:

  • 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

Available icons are located in the mimetypes directory of the albatross or finch skin.

For instance for a jpeg file the result will be:

jpg.png

Tags:
Created by Luis Arias on 2007/04/08 09:51
Last modified by Vincent Massol on 2008/09/30 10:12

This wiki is licensed under a Creative Commons license
2.2.1.27354