Skip to content
Code on GitHub (opens in a new tab)

← All the news

Ehundu 1.1.0

The ehundu imagenes command. 1.1 adds a command that generates the width variants of images (img/foto-480.webp, img/foto-960.avif…), with the widths and formats declared in the imagenes section of sitio.yml (§2) and the file names that variantes(), the [imagen …] shortcode and Markdown figures already looked for. Until now each site had its own loose script for this, with nothing to guarantee that its names and widths matched sitio.yml. It is a separate command: compilar does not run it and the build still processes no images (§9, §9.2 and decision 153 in docs/formato.md (opens in a new tab), which is in Spanish).

What it does to each image. From every JPEG, PNG or WebP in publico/, or from a folder of originals with --originales=folder (which mirrors the structure of publico/), it writes one file per width and per format: WebP, AVIF, JPEG or PNG. It only scales down: it never enlarges (an image narrower than a width gets that file at its own width) and never crops. It rotates the image as the camera recorded it and copies nothing but the pixels, so the location of a phone photo never reaches the web; transparency is kept in AVIF, WebP and PNG, and in JPEG the image comes out on white. Quality is fixed (WebP 80, AVIF 55, JPEG 82, lossless PNG). It does not redo what already exists, and --forzar redoes everything: it does not go by dates, because in a Git clone they are all the same. A damaged image, or one too big for PHP's memory, is reported with its path and the command goes on with the rest.

It needs the gd extension, which the rest of the engine does not require and composer.json only suggests. Without it, or if the site asks for a format its GD cannot write, the command stops with an error saying so and writes nothing.

In the repository. SECURITY.md (opens in a new tab), on how to report a security issue, and automated tests on GitHub Actions, with PHP 8.4 and 8.5, on every change.

Upgrading from 1.0. Nothing to do. Built with 1.0.0 and with this release, the twenty-eight projects used for testing produce the same files, one by one, and the same warnings, so no site needs republishing. The command is new and that is growth (§12, rule 5): nothing runs it unless asked.

What is still not done. The component catalogue, style tokens, processors over the generated HTML, steps after the build, and search. For images, cropping to a proportion and configurable quality remain. They can arrive within version 1 because they only add.

This version on GitHub (opens in a new tab), with the ehundu.phar.