“File Extension Icon” is a plugin for ExpressionEngine. It returns an icon or the file type as text for a specific file, based on the file's extension.
The plugin returns an icon (or the type as text) for a specific file based on the file extension (ie. .gif, .jpg, .pdf).
The default parameters works great with the Silk icons by FamFamFam but you can customize the icons any way you want.
Basic usage:
{exp:file_ext_icon width="10" height="10"}http://www.somesite.com/some_file.jpg{/exp:file_ext_icon}
Returns:
<img src="/images/icons/jpg.png" alt="jpg" width="10" height="10" />
Making use of the print_type parameter (to add CSS class in this case):
<li class="{exp:file_ext_icon print_type='yes'}http://www.somesite.com/some_file.jpg{/exp:file_ext_icon}">Text</li>
Returns:
<li class="jpg">Text</li>
widht: the icon image width in pixels (default is 16). (10)height: the icon image height in pixels (default is empty) (10)path: the path to the icon folder with trailing slash (default is '/images/icons/'). (path/to/file/)ext: the extension of the icon files (default is 'png'). (type)class: the class of the image (default is empty). (className)print_type: returns the extension of the file, ignoring all other parameters. (yes/no)
Download File Extension Icon plugin for ExpressionEngine.
See the ExpressionEngine Forums thread for more information.
By downloading this you also take full responsibility for using this plugin. We believe it's good and try our best to write un-fucked code, but if you mess up it's your fault... ;-)