I would like to autogenerate a thumbnail of PDF's, and from this question I found the plugin PDFThumb. The problem I'm running into is I'm relatively new to Craft, and I can't seem to figure out how to use the provided code when it is with a Matrix field.
As I said I'm new to this, and I usually end up tying myself in knots when trying to backtrack the variable references, and I think that's the problem here.
The reference code from the plugin repo:
{% for myAsset in item.assetRef %}
<img src="{{ craft.PDFThumb.thumbnail(myAsset) }}">
<img src="{{ craft.PDFThumb.thumbnail(myAsset, 100, 100) }}">
<img src="{{ craft.PDFThumb.thumbnail(myAsset, 100, 150, true, 'jpg') }}">
{% endfor %}
And my code:
{% set pdfBlocks = entry.infoPagePDF.all() %}
{% if pdfBlocks|length %}
{% for block in pdfBlocks %}
{% if block.type == "pdf" %}
{% if block.pdfFile %}
{% set rel = block.pdfFile.one() %}
{% if rel %}
<a href="{{ rel.url }}">{{ rel.title }}</a>
{# Autogenerated Thumb #}
{% for myAsset in item.assetRef %}
<img src="{{ craft.PDFThumb.thumbnail(myAsset) }}">
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
The link generates fine, it's the image that doesn't.
I've tried a bunch of different variations, but the problem (I think) revolves around the fact I'm not sure what I'm supposed to be referencing in the FOR
(myAsset and item.assetRef), so for clarity I reset my attempts to the provided code example.