Create Thumbnail from Cover Image

Not had enough coffee today, so I am struggling on the logic to use here …

I have a number of page bundles with a cover image in the bundle; e.g.

/content/news/2024
       /news item
             cover.jpg
             index.md

What I need to do is create a thumbnail image of the cover.jpg to use in my search results. How could I at build time, create a thumbnail and store the thumbnail in the page’s resources (so I can pull out the PermaLink later) ?

thanks

Much better after having had some coffee …

Sorted this by creating the thumbnail when I build the JSON file for the search index. The obvious answer is always the last one I consider :smile:

A tip if you use these thumbnails in several locations (both search and on e.g. home page) is to pull out the thumbnail logic into a partial that returns the thumbnail. That ways you’re using the same size setting etc. and only end up with one set of thumbnails.

1 Like

thanks @bep - sensible approach.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.