AttachIcons

Summary: Add icon images to Attach file links according to file extension
Version:
Prerequisites:
Status:
Maintainer:
Discussion: AttachIcons-Talk
Users: (View? / Edit)
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/--) (invalid link)

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

Notes

Release Notes

See Also

Contributors

from pmwiki userlist: Anno, Marc, Pm

Comments

See discussion at AttachIcons-Talk