Problem/Motivation
Currently there is no relationship between uploaded PDFs and generated previews. The previews is generated on demand based on the module's filename settings and we can't reliably determine which previews belongs to which PDF, particularly when using md5 filenames. In particular, this is a blocker for #2553845: Preview image should use same file system as that of its parent PDF.
Proposed resolution
Generate the preview when the PDF is created/updated and store it in managed files. Also ensure the preview is deleted when the PDF is deleted. We probably also need to keep the on-demand generation for previews that haven't been created yet, e.g. due to module upgrades, config changes, etc.
Remaining tasks
- Determine which PDFs should have a preview generated, possibly via field config
- Implement CRUD hooks for file entities
- Save the generated preview to managed files
- Record file usage of the preview, possibly against the PDF file entity, or the entity the file is attached to
- Update script
- Tests
User interface changes
TBD
API changes
TBD
Data model changes
TBD
Release notes snippet
TBD
Original report by PascalAnimateur
Is there a specific reason why the generated thumbnail image isn't created as a managed file? This would allow using it as any other image throughout the site without relying on pdfpreview to display it...
Comments
Comment #1
helmo commented+1 It would also open up a way to do access checks.
PS: changing the title as the generated preview image can have a thumbnail of it's own ;)
Comment #2
mstrelan commentedComment #3
mstrelan commentedI've opened up a 2.0.x branch for this feature.
Comment #4
mstrelan commented