-
-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PDFs Have No Thumbnail Or Icon In Media Gallery #1984
Comments
Closed in #2089. |
For my team of authors, there are issues recognising PDFs in the media library. Without a preview to aid recognition, they rely on the file naming, which is often inconsistent, unpredictable, and often out of their control. For us, a preview image of the first page would make PDF's much more recognisable, by giving some more information about the contents of the file. This is a familiar pattern from Google Drive, Drop Box etc. I think the current solution was a good first pass, and now we could use this issue to discuss improvements / possible solutions, @erquhart would you be up for re-opening this? |
Re-opening - this https://github.com/mozilla/pdf.js/ might serve as a solution as long as it doesn't add to much to our bundle size. |
Thanks @erezrokah 🍞 |
Spitballing here, but maybe PDF thumbnails could be generated by a third-party image service like Cloudinary. You could even defer the implementation of that image service to the developer. Say by adding a - name: "pdf"
widget: "file"
thumbnail_url: "https://res.cloudinary.com/<cloudinary-id>/image/fetch/<transforms>/{{site_url}}/{{public_path}}.jpg"
# Appending `.jpg` tells Cloudinary to convert the given PDF file to a JPG. Cool beans! Yeah, it’s a bit scrappy and definitely hinges on the magic of Cloudinary’s Fetched URL API, which simultaneously uploads an asset from a given URL and responds with a transformed asset. Figured it was still worth sharing! Folks hosting on Netlify could get super slick with it too, proxying friendlier URLs to Cloudinary: # netlify.toml
[[redirects]]
from = "/pdf-to-jpg/*"
to = """\
https://res.cloudinary.com/\
<cloudinary-id>/\
/image/fetch/\
q_auto,f_auto,w_720/\
https://example.netlify.app/:splat.jpg\
"""
status = 200 |
Describe the bug
When a
.pdf
file is uploaded to the Media Gallery, it's preview card is blank. No thumbnail is generated for it. Note that this remains true after a page refresh. Thumbnails are generated for images.To Reproduce
Expected behavior
Either a Thumbnail, or a PDF icon is displayed on the file's preview card.
Observations
Screenshots
Applicable Versions:
The text was updated successfully, but these errors were encountered: