feat!: refactor the api endpoint to follow and fix #9

This commit is contained in:
Gustavo "Guz" L. de Mello
2024-06-12 16:08:12 -03:00
parent 3f37c60e75
commit 3b1399390e
3 changed files with 188 additions and 147 deletions

View File

@@ -6,23 +6,23 @@ templ Image(src templ.SafeURL, alt string, class string) {
<picture class={ class }>
<source
media="(min-width: 1536px)"
srcset={ "/api/image?scale=-6&url=" + url.PathEscape(string(src)) }
srcset={ "/api/image?threshold=1536&url=" + url.PathEscape(string(src)) }
/>
<source
media="(min-width: 1280px)"
srcset={ "/api/image?scale=-7&url=" + url.PathEscape(string(src)) }
srcset={ "/api/image?threshold=1280&url=" + url.PathEscape(string(src)) }
/>
<source
media="(min-width: 1024px)"
srcset={ "/api/image?scale=-8&url=" + url.PathEscape(string(src)) }
srcset={ "/api/image?threshold=1024&url=" + url.PathEscape(string(src)) }
/>
<source
media="(min-width: 768px)"
srcset={ "/api/image?scale=-9&url=" + url.PathEscape(string(src)) }
srcset={ "/api/image?threshold=768&url=" + url.PathEscape(string(src)) }
/>
<source
media="(min-width: 640px)"
srcset={ "/api/image?scale=-10&url=" + url.PathEscape(string(src)) }
srcset={ "/api/image?threshold=640&url=" + url.PathEscape(string(src)) }
/>
<img src={ string(src) } alt={ alt } class="w-100% h-100%"/>
</picture>