Closed cedpar closed 8 months ago
the upl-image-preview is only designed to preview files that are natively stored as images. In practice it should allow previewing any file that a browser can render inside of an <img src="">
tag. I suppose Safari somehow implemented PDF as a valid IMG source when all other browsers have not.
I am not finding any official documentation on why Safari choose to implement this and how it's supposed to work. The only relevant result seems to be this StackOverflow question but it doesn't lead to any useful information https://stackoverflow.com/questions/70193677/chrome-does-not-allow-me-to-use-pdf-in-img-tag In any case I doubt any browser is actively working to implement such a feature. I don't believe it's part of any web standard existing or in development.
FoF Upload does not have any native way to preview PDFs. Another extension could provide a new template that does. An easy solution would be to render the PDF in an iframe as it would take advantage of the browser ability to render a PDF viewer, but this would be dangerous to safeguard against XSS vectors. A safer solution would be an extension that implements a server-side rendering of a preview image and returns it to the frontend in a new template. I doubt either of these options would be added to FoF Upload directly at this moment as they require significant work and increase the maintenance burden.
If you still believe this is a bug with an existing FoF Upload feature, feel free to re-open the issue with more details.
Bug Report
Current Behavior PDF files are not displayed
Steps to Reproduce
Expected Behavior Problem with upl-image-preview
Screenshots With Safari :
With Chrome :
Environment
Additional Context I tried to change the MIME type but it doesn't work