Pthumb with Static Resource

I have a “Downloads & Resources” collection containing many PDFs stored in static resources. The physical file paths are therefore different from the modx generated paths. I generate resource listings using pdoResources, complete with generated pThumb thumbnails using a tpl with code similar to:

<img class="border img-fluid mr-3" src="[[!pthumb? &input=[[+content]] &options=&zc=T&far=1&w=50&h=50&aoe=0&f=png]]" width="64" height="64">

Everything about the above works great. No issues

My problem is I need to manually create some thumbs now. I thought that perhaps using fastfield to get the resource content - which should be the real path of the static resource - that it would work. It does not. It ends up forcing the page to show the PDF at the path, effectively replacing the page’s content to the end user.

<img src="[[!pthumb? &input=[[#63.content]] &options=&w=125&h=160&zc=0&aoe=0&far=0&f=png]]" class="card-img mx-3 border shadow-sm" alt="..." />

So - how do I get the actual physical path of my static resource into that “&input” option above of my pthumb call?

Maybe instead of fastField you can use the extra getResourceField.

[[getResourceField? &id=`63` &field=`content`]]

@halftrainedharry FTW! This worked. Thanks for the suggestion. I have never used this extra - most of the functionality is covered by FastField so I’ve never played with it. Good to know there’s a handy option.

Cheers! :tropical_drink: :tropical_drink:

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.