Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
How do I show a file-extension related icon on attachments?
rbrahmson
✭✭✭
I'd like to show the relevant icon associated with attachments (e.g. .doc, .docx, .xls, .xlsx) rather than the generic one
Any ideas?
0
Best Answer
-
jackmaessen ✭✭✭
in class.mediamodel.php of Uploader plugin there is this piece of code about line 190
public static function ThumbnailUrl(&$Media) { if (GetValue('ThumbPath', $Media)) return Gdn_Upload::Url(ltrim(GetValue('ThumbPath', $Media), '/')); $Width = GetValue('ImageWidth', $Media); $Height = GetValue('ImageHeight', $Media); if (!$Width || !$Height) { if ($Height = self::ThumbnailHeight()) SetValue('ThumbHeight', $Media, $Height); return '/plugins/FileUpload/images/file.png'; }
You can see the file.png is default loaded. So you have to make a kind of switch with cases to load different .png files
2
Answers
What are you using for attachments?
Search first
Check out the Documentation! We are always looking for new content and pull requests.
Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.
which one do you mean, the big one or the little one?
The big one...
And I'm using the Uploader plugin for attachments
in class.mediamodel.php of Uploader plugin there is this piece of code about line 190
You can see the file.png is default loaded. So you have to make a kind of switch with cases to load different .png files
Thanks @jackmaessen - I wrongly assumed that the icon is determined by Vanilla regardless of what is used to upload the attachment... Your quick response redirected me to the right spot. I appreciate your help!