Skip to content

3.0.0 β€” WebP & AVIF for Kirby 4 & 5

Latest

Choose a tag to compare

@felixhaeberle felixhaeberle released this 21 Jul 21:03

Complete rewrite for Kirby 4 & 5 (PHP 8.1–8.5), verified by a test suite running real Kirby instances (25 tests green on Kirby 4.9.5 and 5.5.2). Existing v1/v2 configs keep working.

Fixed

  • Kirby 4/5 compatibility (#15): removed contentFileDirectory() call, hook bindings work across Kirby 3/4/5 argument conventions
  • PHP 8.2+ dynamic property deprecations (#14)
  • Converter errors can no longer break uploads (the old catch referenced a non-existent exception class)
  • file.replace reliably regenerates companions; renaming moves them; deleting cleans them up including meta files
  • Deleting photo.png no longer removes photo.webp while photo.jpg still owns it
  • Uppercase extensions (PHOTO.JPG) convert correctly
  • Corrected Apache/nginx examples (the old nginx snippet used an undefined variable and wrong capture) and documented when content negotiation actually applies on stock Kirby (/media hash folders β€” the root cause behind #4, #6, #8)
  • Works for composer, submodule and manual installs without a bundled vendor/ directory (#1)

Added

  • Responsive <picture> helpers: $file->picture(), $file->webp(), $file->avif(), snippet('webp/picture') β€” srcset/sizes, CLS-safe dimensions, lazy loading, fetchpriority, no upscaling (#3)
  • AVIF support: 'formats' => ['webp', 'avif']
  • Kirby CLI commands: kirby webp:generate [--force], kirby webp:clean (site + pages incl. drafts + users; cleans v1 leftovers like *.lossy.webp, #7)
  • Collision-safe naming scheme: 'scheme' => 'filename' β†’ photo.jpg.webp
  • $files->withoutCompanions(), $file->companion(), $file->hasCompanion()
  • skipLarger, minSize, sources MIME filter, per-format quality, engine selection
  • Namespaced options felixhaeberle.kirby3-webp.* with full v1 fallback
  • CI matrix: PHP 8.1–8.4 Γ— Kirby 4/5

Changed

  • Conversion uses Kirby's own thumb driver (GD/Imagick/IM) by default; rosell-dk/webp-convert is now an optional engine, picked up automatically when installed
  • Committed vendor/ directory and composer.lock removed
  • Default WebP quality is now 80 (was 90) β€” set 'quality' => 90 to keep the old output

See CHANGELOG.md and the upgrade notes in the README.