#dev 2025-01-06

2025-01-06 UTC
grufwub, gRegorLove_, sebbu and [qubyte] joined the channel
#
capjamesg[d]
Does anyone use AVIF on their website?
#
capjamesg[d]
We don't have a wiki page on it.
#
[qubyte]
I ship jpeg/webp/avif for photos in 1x and 2x wrapped in a picture element.
#
capjamesg[d]
[qubyte] How do you convert to AVIF?
#
[qubyte]
A GitHub action watches an images directory for new jpegs, and then processes them with a Node module called Sharp. It’s very good.
#
capjamesg[d]
Is your code open source?
#
[qubyte]
AGPL, but you’re very welcome to remix/reuse these bits:
#
capjamesg[d]
Thank you!
#
[qubyte]
Line 9 on the latter is important. It ensures that the image ends up in the right orientation. Also worth noting, metadata is scrubbed from the jpegs before they get committed and kick off this process.
#
capjamesg[d]
I have been building a solution in Python for my image needs but it doesn't look like there is great Python AVIF support 😭
#
capjamesg[d]
I may wait until it's done.
#
[qubyte]
If examples of picture element markup are useful, my notes index has lots. https://qubyte.codes/notes/
#
Loqi
[preview] [fdintino] #5201 Add AVIF plugin (decoder + encoder using libavif)
#
capjamesg[d]
Wow, sharp is neat!
nemonical joined the channel
#
[qubyte]
Another route if you use an actions workflow might be imagemagick. I found it a bit challenging for this use case and I already had sharp as a dependency, but if you want to avoid node deps it may be an option.
#
capjamesg[d]
Node looks good!
#
capjamesg[d]
Why did you choose 800 / 1600 for the image sizes?
#
capjamesg[d]
I have been reading into responsive images on web.dev but I worry about serving lower quality images.
#
[qubyte]
lol `main { margin: 0 auto; max-width: 800px }` hard coded because I’m lazy. 😅
#
[qubyte]
(it matches the max column width)
#
capjamesg[d]
Good to know!
#
[qubyte]
In the future I may pass this in as a parameter, but for now it’s good enough.
#
[qubyte]
Actually that’d be a really good idea. I use this script by invoking it manually too, and sometimes the image width I want differs, like on my favourite music page. https://qubyte.codes/blog/favourite-music
#
capjamesg[d]
[qubyte] Is there any advantage of using multiple <source> files when I could use content negotiation?
#
[qubyte]
It sort of is content negotiation, upside down and in disguise. The browser will only download the image it deems most appropriate (given form factor, bandwidth, etc.)
#
capjamesg[d]
The average reduction in file size from png/jpeg to webp for all assets on my blog is 332.89KB.
#
capjamesg[d]
And 363.61KB from png/jpeg to AVIF.
Ed1 joined the channel
#
Ed1
Hey everyone. I'm trying to implement Webmentions usong webmentions.io and/or telegraphp3k.io, but both website return an error when I login
#
Ed1
And it's kind of weird since the "normal" indielogin works just fine
#
Ed1
Any idea of what can I debug? Thanks!
#
aaronpk
i did just change a bunch of stuff on indielogin.com yesterday
#
aaronpk
i didn't think it should break things tho, but i will look
#
Ed1
Oh wow, thanks! If it might help when I login into telegraph.p3k.io I get this error: HTTP 500 {"response":[],"raw_response":"","response_code":500}
#
Ed1
Elswehere I get a simple page with unexpected end of JSON input
#
aaronpk
sure enough i broke it
#
Ed1
If I can help providing other informations I'm here, thanks
#
aaronpk
found it
#
aaronpk
should be fixed now!
#
Ed1
Amazing, let me retry!
#
Ed1
IT WORKS! Thanks again <3
#
Loqi
woot
ttybitnik and [Joe_Crawford] joined the channel
#
capjamesg[d]
[Joe_Crawford] I have a CSS question!
#
capjamesg[d]
When I load https://jamesg.blog/2024/12/21/persistent-information-on-scroll/, there is a layout shift while the image loads because I haven't set a height/width attribute.
#
capjamesg[d]
[edit] When I load https://jamesg.blog/2024/12/21/persistent-information-on-scroll/, there is a layout shift while the image loads because I haven't set a height/width attribute.
#
capjamesg[d]
But the image size adjusts as the page grows with CSS, between a min and max.
#
Loqi
[preview] [James] Advent of Patterns: Persistent information on scroll
#
Loqi
[preview] [James] Advent of Patterns: Persistent information on scroll
#
capjamesg[d]
How should I set the height/width in HTML so I don't get that layout flash?
#
capjamesg[d]
Maybe it should just be the image resolution?
#
capjamesg[d]
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img says "The intrinsic height of the image, in pixels. Must be an integer without a unit."
#
capjamesg[d]
[edit] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img says "The intrinsic height of the image, in pixels. Must be an integer without a unit."
#
GuestZero
kind of a stupid question – is the 'indieweb' movement interested in the www in the strict sense or do you bother/are knowledgeable with email servers etc as well..?
[Murray] joined the channel
#
[Murray]
[capjamesg] yeah, it should either be the resolution, or the max dimensions (former is typically best, and highlights when you might be using images that could be compressed)
#
[Murray]
you often see this automated from things like CDNs, which allow you to fetch the original width/height alongside the image
[mattl] joined the channel
#
[mattl]
GuestZero: tends to be web stuff.
#
artlung
capjamesg[d] yes, setting a height attribute and a width unit has been standard since the first <IMG> tags. CSS then will infer the aspect ratio from that. I have also in some cases set an inline style attribute with an aspect ratio. So for that image: `<img alt="" src="/assets/indiewebwikipage.png" width="2358" height"1260">` or `<img alt="" src="/assets/indiewebwikipage.png" style="aspect-ratio: 2358 / 1260">`
#
artlung
I believe the layout engine knows beforehand what the width of that image *can* take up, so once it reads aspect ratio (either way) it will allocate space for them.
#
artlung
And in my old-man mode, I feel like. it was the iCab browser which didn't do that at all, which made for a kind of charming jank as assets loaded onto a page and the page assembled itself.
#
[mattl]
Registered iCab user here. Modern iCab is just WebKit though so probably does it correctly.
#
artlung
In my email I have a 2012 purchase of iCab Mobile (Web Browser), v5.8 (17+). I *think* I bought iCab way back when. But it might have been by -- like sending a check to Germany or something back then. Memory hazy.
#
artlung
I want to say it was considered "Shareware" at the time?
gRegorLove_ and ttybitnik joined the channel
#
[qubyte]
Setting the width and height is also useful when you do `loading="lazy"`, which I do on that long notes page. When the browser behaves itself it only has to download and add the images as you scroll (no layout changes).
Ed1 joined the channel
#
Ed1
I'm trying to implement webmentions in Ghost, but it seems like even if I have everything set up correctly they won't show up. I think it's because they recommendation feature overlaps the webmention.io implementation, is that possible?
#
gRegor
what is Ghost
#
Loqi
Ghost is an an open source CMS for blogging, general web publishing, newsletters, and paid subscriptions, and also a hosted silo at https://ghost.org https://indieweb.org/Ghost
#
gRegor
Yeah, I believe Ghost always advertises its own webmention endpoint, which is tied to its recommendations feature. Not sure if you could successfully add a webmention.io endpoint
#
gRegor
From brief testing trying to send a "regular" webmention to a friend's Ghost site, it didn't really work. Ghost is expecting a specific JSON file for the recommendations it receives.
#
gRegor
Maybe if you can find a setting to disable the recommendations feature, then add your webmention.io endpoint in the HTML, that would work.
#
capjamesg[d]
[Joe_Crawford] If I set the height / width, it stretches the image 😦
#
capjamesg[d]
Oh, setting height: auto fixes it...
#
artlung
Classic Rubber 🦆 debugging. Nice.
#
artlung
Well, maybe not precisely that. But close.
#
gRegor
Think that means the aspect ratio of the w/h is set wrong?
#
capjamesg[d]
This should be live on my site in a min.
#
artlung
I think I tend to use height and width but I also do like an inline aspect-ratio in a style attribute.
#
artlung
I have not checked browsers to see what happens if those are in conflict. I suspect the style attribute would win.
#
[mattl]
is your site's TLS configured in a way to not work on older browsers? Not sure how much you care to test.
#
capjamesg[d]
This is all very complicated 😭
#
capjamesg[d]
I'm setting up a git submodule so my project has access to the images to get the heights and widths.
#
capjamesg[d]
[mattl] My site?
#
Ed1
Okay okay I'm digging into this rabbit hole, but coming out stronger. Apparently there's this helper (ghost_head or smth like this) that includes all the stuff (including webmentions). I just need to try and create a theme that uses all the ghost_head content except for the webmention in order to override their default implementation.
#
doesnm
[mattl]: why you are using older browser?
#
[Joe_Crawford]
@capjamesg[d] images are first class elements, and deserve the care you are taking to get their display right. I know your preferred domain is in the words, but the pictures matter too.
#
[mattl]
[doesnm] I'm not using it as my main browser but I do frequently use computers that are 30-40 years old.
#
capjamesg[d]
[Joe_Crawford]++
#
Loqi
[Joe_Crawford] has 15 karma in this channel over the last year (114 in all channels)
#
capjamesg[d]
I'm excited to be learning about all these details of the web.
#
[Joe_Crawford]
Your expertise grows daily.
#
gRegor
Ed1++ good luck! If you write about the process, definitely add it to /Ghost (or maybe update that page directly as a how to)
#
Loqi
Ed1 has 1 karma over the last year
#
[Joe_Crawford]
[mattl] I came across https://www.youtube.com/@ActionRetro the other day. Enjoyed the walkthrough exhuming an SGI Indigo2.
#
[mattl]
Yeah, I like some of the content but the clickbait titles on videos aren't great
#
[Joe_Crawford]
True. True. The YT creator set up http://frogfind.com (no ssl required) as a frontend for DDG search so he can load it on old computers.
#
capjamesg[d]
I think it's working?
#
Loqi
[preview] [James] Advent of Patterns: Diffs
#
Loqi
[preview] [James] Advent of Patterns: Diffs
#
[mattl]
[Joe_Crawford] frogfind is nice. however he sold it as "I Built a Search Engine... for Vintage Computers!" -- which he didn't
#
[Joe_Crawford]
Yes, no mention of the giants' shoulders he stands on.
#
gRegor
capjamesg[d], looks good, though Chrome warns that the `aspect-ratio` property is invalid
#
gRegor
Oh, Chrome is also using the .avif, maybe the aspect ratio stuff isn't working on that?
#
capjamesg[d]
Where are you getting that error gRegor?
#
gRegor
Chrome dev tools
#
capjamesg[d]
Maybe I can't use attr()?
#
gRegor
Inspect the img element, then the Styles drawer shows the properties. There's an alert beside the aspect-ratio. Not sure if that's because it doesn't support `attr()` there or?
#
gRegor
I'm not familiar with `attr`
#
gRegor
max-width 130% seems a bit weird, I think that might be related to the stretching (when I turn off the height)
#
[Joe_Crawford]
Heh. James I would not do `attr(width) / attr(height)`
#
[Joe_Crawford]
Conceptually, what you have is 100% correct. In reality the attr() function doesn't ... uh... work.
#
[Joe_Crawford]
I mean, you can get a string out of it, yes. But for doing what you're doing, no.
#
gRegor
Disregard, not the max-width 130% causing it. Odd.
#
capjamesg[d]
Are you seeing stretching gRegor?
#
capjamesg[d]
In Chrome everything looks okay for me.
#
gRegor
I'm tinkering to try to figure out why it was stretching
#
capjamesg[d]
(although the aspect-ratio value is broken)
#
capjamesg[d]
Oh yeah. I'm not sure 😭
#
[Joe_Crawford]
I wanted to use it to do things like `<div class="graph" data-percent="65%"></div>` then use it in `div.graph { conic-gradient(red attr(data-percent), transparent 0)}` but it simply doesn't work like that.
#
[Joe_Crawford]
`div.graph { background: conic-gradient(red attr(data-percent), transparent 0)}`
#
[Joe_Crawford]
`<div class="graph" style="--data-percent: 65%"></div>` and `div.graph { background: conic-gradient(red var(--data-percent), transparent 0)}` DOES work though.
#
capjamesg[d]
The downside of this implementation is my deploy times are going to go up by a minute.
#
capjamesg[d]
But I think it's worth it.
#
capjamesg[d]
I can work around that another day.
#
gRegor
Aha, `article img { width: clamp(100%, 130%, 65vw); }`
#
[Joe_Crawford]
can you cache those image sizes? I mean, re-reading them every time you build seems like overkill.
#
gRegor
Turning that off prevented the stretching when I use only explicit height and width on the img
#
capjamesg[d]
gRegor The aspect ratio should be correct now.
#
capjamesg[d]
The clamp is necessary for the effect I want.
#
gRegor
Yep, Chrome isn't complaining now
#
capjamesg[d]
The clamp lets the image grow / shrink in size depending on the width of the page, up to a max.
GuestZero_ joined the channel
#
capjamesg[d]
I should write a blog post about all of this.
#
Loqi
gRegor has 34 karma in this channel over the last year (129 in all channels)
#
capjamesg[d]
[Joe_Crawford]++
#
capjamesg[d]
for all the help!
#
capjamesg[d]
I'm curious how the images look, visually. Does everything seem as expected?
#
[Joe_Crawford]
I have only seen the title of this bandied about and I do love it. Shades of Heydon.
#
[Joe_Crawford]
And capjamesg[d], yes site looking good!
sebbu2 joined the channel
#
[KevinMarks]
today in day job fun - "why doesn't this coverage map display in Chrome, it works in Edge and Firefox?"
#
[KevinMarks]
the coverage maps are rendered as a gif from some big GIS tool, and overlayed on top of leaflet maps as an image layer. This mostly works OK, but this particular one is the whole of the UK and is thus a 13476 by 22877 gif which is 5.8MB on disk and around 1.2GB as a pixel buffer. I'm amazed anything renders it without crashing, so well done to the browsers that manage it, I dread to think what is going on in the compositing loops there.
gRegorLove_ and claudinec joined the channel
#
[mattl]
Careful with that Wired article, it's by some AI person
#
[tantek]
what's an "AI person"? like advocate? evangelist? developer?
#
capjamesg[d]
"Tim Carmody works at an AI education company and is a former senior writer at WIRED."?
#
[tantek]
so advocate/evangelist then
#
[tantek]
anyway, if the content of the articles stands as is, no need to ad hominem
#
[mattl]
[tantek] not ad hominem, but it's why i didn't share it
#
[tantek]
[mattl] fine of course not to share things
#
[tantek]
implying that the Wired article is something that needs special care ("careful with") due to an attribute of the author ("AI person") is a form of ad hominem criticism of the article
#
[tantek]
from wikipedia ad hominem "attacks the character, motive, or some other attribute of the person making an argument rather than the substance of the argument itself"
ttybitnik joined the channel
#
_pi_r2_0[d]
In all fairness, I do totally question results from research based on how it's financed for example
#
_pi_r2_0[d]
Because I can't reproduce every study, I have to base myself on the evidence presented to me, and going to motive seems absolutely fair. If that's ad hominem I'm not firmly against it.
#
_pi_r2_0[d]
There could be eg p-hacking even if the results presented are technically an accurate representation of reality.
#
_pi_r2_0[d]
Not quite convinced it's all that relevant for this article though? (I'm an working for an "AI" company, and what's more one working on browser-based agents… yet I don't think "AI" opponents need worry about how I earn a living when I talk about HTML…)
glacier joined the channel
#
carrvo[d]
According to Wikipedia ad hominem gets a reputation of being a fallacy, but may not always be. And I think that is a fair point for Wikipedia to include because when you talk about a study or an experiment, the evidence they gather may not include all evidence there is to be had. In fact, that should be almost always impossible to achieve. So evidence can be selectively filtered (hence bias and fallacy). However, most consumers take for grant
#
carrvo[d]
Crime statistics, for example, are notoriously influenced by the amount of crime reported. Real crime numbers are expected to be higher due to many people not reporting crimes for various reasons.
#
carrvo[d]
But people can and do rely on the biased statistics to make decisions, and the presence of the bias is rendered rather unimportant.
IWSlackGateway and Ed1 joined the channel
#
Ed4
Finally I got around the webmentions in ghost and now they work! YAY!
[tantek] joined the channel
#
[tantek]
Ed4++ congrats!
#
Loqi
Ed4 has 1 karma over the last year
#
gRegor
Ed4++
#
Loqi
Ed4 has 2 karma over the last year
#
Ed4
Thanks <3 Now the only problem is understanding how to get back the Ed nickname here ahahaha
#
Loqi
nice
#
Ed4
(Btw I missed so much this feeling of getting back the internet into a "personal" space)
#
Ed4
Anyway, it's a problem for the me of tomorrow, I need some sleep now :D
glacier joined the channel