惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

AWS News Blog
AWS News Blog
T
Tenable Blog
Project Zero
Project Zero
T
The Exploit Database - CXSecurity.com
L
LINUX DO - 热门话题
T
Threat Research - Cisco Blogs
T
Threatpost
Security Latest
Security Latest
C
Cisco Blogs
L
Lohrmann on Cybersecurity
S
Security @ Cisco Blogs
Google Online Security Blog
Google Online Security Blog
NISL@THU
NISL@THU
AI
AI
V
Vulnerabilities – Threatpost
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security
C
CXSECURITY Database RSS Feed - CXSecurity.com
The Last Watchdog
The Last Watchdog
G
GRAHAM CLULEY
Cloudbric
Cloudbric
H
Hackread – Cybersecurity News, Data Breaches, AI and More
H
Hacker News: Front Page
U
Unit 42
A
Arctic Wolf
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
MyScale Blog
MyScale Blog
O
OpenAI News
Scott Helme
Scott Helme
V2EX - 技术
V2EX - 技术
P
Proofpoint News Feed
博客园 - 叶小钗
Hugging Face - Blog
Hugging Face - Blog
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Cyberwarzone
Cyberwarzone
博客园 - 【当耐特】
H
Heimdal Security Blog
S
Schneier on Security
阮一峰的网络日志
阮一峰的网络日志
Help Net Security
Help Net Security
D
DataBreaches.Net
Y
Y Combinator Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
TaoSecurity Blog
TaoSecurity Blog
K
Kaspersky official blog
N
News and Events Feed by Topic
WordPress大学
WordPress大学
P
Palo Alto Networks Blog

Danb Blog

My Experience with Ubuntu Desktop 26.04 · Danb Blog Thumbnails for Orca 3MF in GNOME Files · Danb Blog Cheaper Sodastream Gas with a Big Tank · Danb Blog June 2026: What I've Been Working On · Danb Blog Running Snyk On Forgejo/Codeberg Actions · Danb Blog Tuta & Proton: An Open Source Client Does Not Result in an Open Source Service · Danb Blog May 2026: What I've Been Working On · Danb Blog 3D Printing Parts for my Greenhouse, Round 2 · Danb Blog Great Devices: Nexus 7 2013 · Danb Blog R36S Console RetroArch Stuck Menu Issue · Danb Blog April 2026: What I've Been Working On · Danb Blog Basic OpenCode Sandboxing with Docker · Danb Blog Games Played in 2025 · Danb Blog March 2026: What I've Been Working On · Danb Blog Shivam Mathur's "node-docker" Images are Awesome for PHP CI · Danb Blog February 2026: What I've Been Working On · Danb Blog Your BookStackApp project was assigned as a project for my Software Architecture course · Danb Blog My Sovol SV08 3D Printer Setup in 2026 · Danb Blog January 2026: What I've Been Working On · Danb Blog Epson Printer: The administrator password you entered was not recognized · Danb Blog Pressure to Follow Process · Danb Blog Online Shopping Email Notifications · Danb Blog My HomeLab Setup in 2026 · Danb Blog Linux Label Printing with the Phomemo D30 · Danb Blog Reporting to the CMA: Google Android Developer Verification · Danb Blog OPNsense & Dnsmasq: Responding with specific DNS servers · Danb Blog An Impromptu Introduction to ZFS Drive Replacement at 1am · Danb Blog Experience with UK Medical Cannabis for Ankylosing Spondylitis · Danb Blog Copyright Takedown for Linking to the "State of Open Source" Report · Danb Blog No, Gumroad Did Not Become Open Source Today · Danb Blog Scripting Monitors (KDE on Fedora) · Danb Blog Amber flags in Open Source & Self-Hosted Projects · Danb Blog LLMs are Directing Open Source Licensing · Danb Blog Games Played in 2024 · Danb Blog Beware of Poison in the Source · Danb Blog Common Misconceptions of the AGPL · Danb Blog Adapting GitHub action PHPUnit tests for Codeberg/Forgejo · Danb Blog Lessons from the Allotment · Danb Blog Futo, Please don't attempt to create your own Open Source Definition · Danb Blog Material You (Dynamic/Adaptive) Colors in Legacy Android Apps · Danb Blog Scripting Monitors (Gnome & Wayland on Fedora) · Danb Blog Retaining a Greenhouse Roof with 3d Printing · Danb Blog Games Played in 2023 · Danb Blog Lessons From Growing Food Indoors · Danb Blog Why the Distinction Between "Open Source" and "Source Available" is Important · Danb Blog Raspberry Pi Camera Module 3 Timelapse · Danb Blog Removing the Rear Seats on a Volvo C30 · Danb Blog Reporting Google's WEI to the CMA · Danb Blog Controlling Default GRUB Boot Option via USB · Danb Blog Creating a Video Home for FOSS Projects · Danb Blog Paying for Search · Danb Blog My Favourite Static Site Deploy Method · Danb Blog PhpStorm (JetBrains IDE) 2023 Linux Scaling · Danb Blog Synology Hibernation with Active Backup for Business and Tailscale · Danb Blog My 2023 HomeLab Setup · Danb Blog Redefining Open Source via "Commercial Open Source" · Danb Blog Moving to Mastodon · Danb Blog Gaining Sponsors · Danb Blog "This is a Low Maintenance Project" · Danb Blog Upgrading my CPU, Ryzen 2600 to 5800x · Danb Blog Migrating Google Photos to my Personal NAS · Danb Blog Scheduling Proxmox Storage to Reduce Disk Activity · Danb Blog Why the Term "Open Source" is Important · Danb Blog Lessons From Working for Myself (9 Months In) · Danb Blog Misrepresenting Open Source for Business Benefit · Danb Blog My 2022 Workstation Setup · Danb Blog Leaving my Job to Focus on Open Source (For a bit) · Danb Blog Quickly Getting Placeholder Images With Unsplash Source · Danb Blog A Thanks to Laravel for the LTS Releases · Danb Blog A Quick Overview of Unix-Style Permissions · Danb Blog The Power of currentColor · Danb Blog Dealing With Ankylosing Spondylitis Flareups · Danb Blog Hugo Verbose Dates With Suffixes · Danb Blog
Cat Images in WebP · Danb Blog
2022-01-17 · via Danb Blog

This post is a little test to play around with a few things:

  1. Images in WebP
  2. CSS grid image gallery
  3. CSS only image expand/overlay

View the page source at around this point to see the CSS & HTML used. Below is the bash script used to convert the images from JPEG:

#!/bin/bash
for filepath in ./original/*.jpg
do
filename=$(basename -s ".jpg" "$filepath")
echo $filename
convert "$filepath" -quality 10 -resize '1200' -define webp:lossless=false -define webp:method=6 "./out/$filename.webp"
done

Loaded in are 42 1200px wide images of my cat Ruby, totalling 2.6MB total image filesize. Images are set to lazy-load so they may not all be fetched upon page load. The image expand/overlay functionality is simplistic, just to get something barely functional. Could achieve greater functionality by wrapping each img tag in a div but I wanted to see what I could quickly achieve with a plain list of image tags within a single grid parent.

Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat Ruby cat

Discoveries

WebP works very nicely for photographic images. In the above I used a quality setting of 10% to really get the filesize down, and they've held up quite well. Seems to "break down" in quality in a much more natural way compared to JPEG with more of a blur than a blocky-mess. An average of 61KB per image seems quite reasonable at 1200px wide.

The gallery works on old focus-based tricks with some newer CSS added in. Since it's focused-based you can use tab to traverse the gallery. Grid works nicely to lay out the images with ease using auto-fit repeating columns to adapt the column count. The newer object-fit and aspect-ratio properties are used to fix the images into the square grid without odd blank spaces.

One of the main challenges with the pop-up image view was getting the image somewhat central, while working with a set max-width to not over-stretch the image. This would be easy with a wrapping element but, lacking that here, I found a left position of max(calc((100% - 1200px) / 2), 4vw) to do the trick.

Another challenge was mobile Safari specific. I needed the "Back" button (Shown above the popup image) to take focus away from the selected image. Most browsers did this by default but Safari needed something focusable. I instead had to make the gallery wrapper (Which also contains the button) focusable and then adjust the button CSS selector to .cat-image-grid:focus-within:not(:focus):after to ensure it shows when an image within the grid is focused but not when the grid itself is the focus.

PS. I'm pretty sure these methods are not great for accessibility and there are tweaks and improvements to be made. Again, this was just for playing around and discovering some new techniques.