falcon icon indicating copy to clipboard operation
falcon copied to clipboard

🚀 [REQUEST] - Generate multiple thumbs formats via smarty function

Open Oksydan opened this issue 1 year ago • 0 comments

Summary

I would like to be able to generate multiple formats inside smarty template from source image. Example:

  <img src="{$myImgSrc}">

  <img 
    srcset="
      {generateThumb src=$myImgSrc w=400} 400w,
      {generateThumb src=$myImgSrc w=800} 800w,
      {$myImgSrc} 1200w
    "
    />

Result:

  <img src="my-img.jpg">

  <img 
    srcset="
      my-img-w400.jpg 400w,
      my-img-w800.jpg 800w,
      my-img.jpg 1200w
    "
    />

This should generate automagically thumbs of that images with given width, keeping aspect ratio of image. If h parameters will be set we will force aspect ratio based on given width/height.

All images should be kept inside cache folder not next to origin img.

Feature target required module/theme

is_themecore

Drawbacks

Might generate a lot of images that might be never used.

Oksydan avatar May 05 '23 21:05 Oksydan