diff --git a/docs/upload/overview.mdx b/docs/upload/overview.mdx index 9b976a557f..55cfad3692 100644 --- a/docs/upload/overview.mdx +++ b/docs/upload/overview.mdx @@ -133,6 +133,11 @@ const Media = { } ``` + + Note:
+ If you specify a function to return an admin thumbnail, but your upload is not an image file type (for example, PDF or TXT) your function will not be used. Instead, Payload will display its generic file upload graphic. +
+ ### Uploading Files diff --git a/src/uploads/getThumbnail.ts b/src/uploads/getThumbnail.ts index ca6adde81b..eb513ab51c 100644 --- a/src/uploads/getThumbnail.ts +++ b/src/uploads/getThumbnail.ts @@ -15,11 +15,11 @@ const getThumbnail = (collection: CollectionConfig, doc: Record filename, } = doc; - if (typeof adminThumbnail === 'function') { - return adminThumbnail({ doc }); - } - if (isImage(mimeType as string)) { + if (typeof adminThumbnail === 'function') { + return adminThumbnail({ doc }); + } + if (sizes?.[adminThumbnail]?.filename) { return `${staticURL}/${sizes[adminThumbnail].filename}`; }