Recent Changes - Search:

Cookbook

PmWiki

pmwiki.org

AttachIcons

Summary: Add icon images to Attach file links according to file extension
Version:
Prerequisites:
Status:
Maintainer:
Categories: Images, Uploads

Questions answered by this recipe

How can I automatically display an icon image specific to a file extension beside an attach link?

Description

The following markup adds an icon for .mov, .doc, and .xls files (but not others). Add the markup definition to config.php or another local customisation file. Extend and adjust the definition for other file extensions according to your needs.

 Markup('attachicon', '<links',
    "/\\bAttach:[^\\s$UrlExcludeChars]*\\.(mov|doc|xls)/",
    "$FarmPubDirUrl/icons/$2.png $0");

You need to create icon images mov.png, doc.png and xls.png and put them in a pub/icons/ directory.

The following markup definition will result in displaying any icon image you created for the associated file extension.

 Markup('attachicon', 'inline',
   '/Attach:(.*?)\\.(\\w{1,4})/',
   "$FarmPubDirUrl/icons/$2.png Attach:$1.$2");

Get your icons from here: www.stylegala.com/features/bulletmadness/

Rename them to be named like this:
pdf.png
xls.png
doc.png
.....
and place them in the icons directory.

Notes

Release Notes

If the recipe has multiple releases, then release notes can be placed here. Note that it's often easier for people to work with "release dates" instead of "version numbers".

Comments

See Also

Contributors

from pmwiki userlist: Anno, Marc, Pm

Edit - History - Print - Recent Changes - Search
Page last modified on September 25, 2008, at 11:55 AM