Creating Smaller Thumbnails

4 posts by 3 authors in: Forums > CMS Builder
Last Post: July 22   (RSS)

So until now I've been happy outputting the default thumbnails created by CMSB using a direct call in the template, which normally size to 600x600:

<img src="<?php echo htmlencode($upload['urlPath']) ?>" />

I still intend to use that same approach on some pages, but I'd also like to be able to resize a smaller thumbnail for short summaries in order to keep Google's Core Web Vitals happy. So I wondered, is there a simple way to additionally output a 100x100 pixel version of the same image? Without changing the original (primary) thumbnail/image or manually uploading a second smaller version, that would be very laborious.

Yes. Tim Hurd is correct. I want to add one small consideration while making this modification.  Hitting "recreate" only scales up to the max size dimensions (w x h) you have allowed for the original upload. For example: you have uploaded a 2000 x 2000 image, and your max allowed size is 600 x 600. You realize you need a 800 x 800 of that image. Changing one of the thumbnail sizes to 800 x 800 will pixelate your image (.jpg, .png, .gif) because the max size in the Db is 600 x 600.  For ease of use for future changes I set my max allowed size to very large and upload the best quality images I can. My first thumbnail will either be the same or a relatively high max size and the rest, maybe 600 x 600, 300 x 300 and 100 x 100. Then months or years later the site needs larger display images it's covered for any recreate changes.

This worked well, thanks Tim. I pressed 'recreate' and it made all the thumbs for me automatically too.