In admin/content/media I need to show file type related icons instead of generic file icon.

From this: generic icon

To this: correct icon

I tried to edit the related thumbnail field in "media" view but no option is present.


  • 1
    Nice screenshot ;) – rémy Oct 28 '19 at 13:27

In the media source plugin for this media type you can find the code generating the thumbnail. See the source code of the "File" media type provider.

To summarize the code, you have to put your thumbnails files for each supported MIME type in the folder configured in the "icon_base_uri" configuration (which is stored in the "media.settings.yml" configuration file).

For example, using the default "public://media-icons/generic" folder and inserting a PDF media, you have to store your thumbnail image under the name "public://media-icons/generic/application--pdf.png" for it to be detected and used.

  • I put a thumbnail in the media-icons/generic folder called "application--msword.png" for .doc files, but when I upload a doc file it is showing the "generic.png" thumbnail from that folder for the doc file... any ideas on why that would happen? – mkimmet Mar 15 at 14:14
  • 1
    I just tried it on a website of mine, and it worked properly using the file "public://media-icons/generic/application--msword.png". I think you should check if you don't have any contrib/custom module overriding that behavior. – Renrhaf Mar 15 at 17:49
  • thanks for the response. I got it working. It appears that you have to either upload a new file, or remove and add the file back before the new thumbnails will show up. – mkimmet Mar 15 at 20:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.