I want to make PDF brochures available for download and for this I have tried several times to integrate this cookbook:
No preview images are generated, only the list of PDFs. No error message appears. In the source code the img tag is missing, which indicates that no preview image was generated. There is also no JPEG in the media folder.
Since I lack the expertise on how the plugin works, I would like to go another way: Upload PDF files and manually created thumbnails (both have the same file name).
Since the PDFs rarely change, the effort to create the thumbnail manually is acceptable.
What should be the code in the template to list all PDF and link it to the preview image?
Unfortunately, this code does not work. The devil is definitely in the details.
<ul>
<?php foreach ($page->documents()->filterBy('extension', 'pdf') as $document): ?>
<li>
<a href="<?= $document->url() ?>">
<?php if ($preview = $page->images()->findBy('name', $document->filename() . '.jpg')): ?>
<img src="<?= $preview->resize(200)->url() ?>" alt="">
<?php endif; ?>
<?= $document->filename() ?> (<?= $document->niceSize() ?>)
</a>
</li>
<?php endforeach; ?>
</ul>