Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better image support #809

Merged
merged 9 commits into from
Jul 5, 2022
Merged

Better image support #809

merged 9 commits into from
Jul 5, 2022

Conversation

h-enk
Copy link
Member

@h-enk h-enk commented Jun 30, 2022

Summary

  • Supports remote images + local images in page bundle or./assets directory
  • Supported types: png, jpeg/jpg, tif/tiff, bmp, gif, and webp
  • All images are responsive + converted to webp per default
  • Supports data:image... in src intead of a URL

Usage

Markdown

![Alt tag](image003.png "Optional title tag")

Shortcode

{{< figure src="screenshot.png" alt="Screenshot of a web page with an aqua theme" caption="For a figure caption can be different than alt text" >}}

Examples

https://deploy-preview-809--doks.netlify.app/blog/say-hello-to-doks/

Basic example

![Image](security-as-code-startup-jit-comes-out-of-stealth-with-38-5m-in-seed-funding.jpg)

will be processed into:

<img class="img-fluid lazyload blur-up" srcset="[/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_38897bd0d9a3988a24a9ccdde0afca0d.webp 480w](http://localhost:1313/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_38897bd0d9a3988a24a9ccdde0afca0d.webp),[ /blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_d13052875c7eb5b874f9c5c970aaba79.webp 720w](http://localhost:1313/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_d13052875c7eb5b874f9c5c970aaba79.webp),[ /blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_be2d94ebf75c470dcaa8f182995e567a.webp 1080w](http://localhost:1313/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_be2d94ebf75c470dcaa8f182995e567a.webp),[ /blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_b519fb73ea333899f8665fcd6aed0139.webp 1280w](http://localhost:1313/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_b519fb73ea333899f8665fcd6aed0139.webp),[ /blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_c459db13c3f8afce1c857ff5f521a188.webp 1390w](http://localhost:1313/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_c459db13c3f8afce1c857ff5f521a188.webp)" sizes="80vw" src="[/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_c459db13c3f8afce1c857ff5f521a188.webp](http://localhost:1313/blog/say-hello-to-doks/_hu53d443cfcf590c1124a0d117c87e819c_443313_c459db13c3f8afce1c857ff5f521a188.webp)" alt="Image" width="1390" height="781">

Motivation

#759 + #634 + #502 + #800

Checks

  • Read Create a Pull Request
  • Supports all screen sizes (if relevant)
  • Supports both light and dark mode (if relevant)
  • Passes npm run test

Credits

Based on DFD Hugo image handling module by Daniel F. Dickinson

Implementation

The image functionality is made available as npm package @hyas/images

TODO

Part of h-enk/hyas-images:

  • Add LQIP support
  • Add imageConvertMethod as an option — think [ Fit | GrowFit | Fill | Resize ]

@h-enk h-enk self-assigned this Jun 30, 2022
@h-enk h-enk added the enhancement New feature or request label Jun 30, 2022
@h-enk h-enk added this to the v0.5.0 milestone Jun 30, 2022
@h-enk h-enk merged commit 9e1f7b9 into master Jul 5, 2022
@h-enk h-enk deleted the images branch July 5, 2022 08:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
1 participant