cdowdy / boltresponsiveimages

Responsive Image Extension for Bolt CMS. Using picturefill and img srcset
MIT License
12 stars 5 forks source link

Allow Low quality Image in src attribute #14

Closed cdowdy closed 7 years ago

cdowdy commented 8 years ago

Ideally I'd like to allow the use of a "low quality placeholder" in the src attribute. This can be useful in these instances:

Example Markup would be:

<img sizes="(min-width: 40em) 80vw,100vw"
     srcset="/thumbs/340x0c/img.jpg  340w,
     /thumbs/680x0c/img.jpg  680w,
     /thumbs/1260x0c/img.jpg  1260w"
<!-- use a low quality image for the src attrib -->
     src="/thumbs/340x0c/low-quality-img.jpg"
     alt="alt text">    

Bolts thumbs doesn't allow the quality to be set for an individual image. Its a global value that's set in the main bolt config (https://github.com/bolt/bolt/blob/release/3.1/src/Helpers/Image/Thumbnail.php#L30-L35) and falls back to 80.

I could write another image handler which over rides bolts settings, or include an image library like intervention or imagine.

So this is here to remind me to maybe do this or rip out bolts thumb handler and do my own which would also allow for passthrough of svg images or webp thumb creation.

cdowdy commented 7 years ago

Went ahead and created a new thumbnail extension

https://github.com/cdowdy/boltbetterthumbs

Allows for low quality source and other things (signed URLs as an example)