medienbaecker/kirby-alter

1.3.3 2025-07-02 15:48 UTC

This package is auto-updated.

Last update: 2025-07-02 15:48:36 UTC


README

A Kirby plugin for generating and reviewing alt texts for images in your sites.

Warning

Use this plugin at your own risk. It was built primarily for my own projects and may not work in yours.

I use some Kirby 5 specific features, but it could potentially work Kirby 4 as well. Please report any issues you encounter.

Features

Panel view

The plugin provides a custom panel view for reviewing and managing alt texts of images across all pages in your site. Each image also gets a "Reviewed" checkbox that gets saved as alt_reviewed in the file's content file.

Screenshot of the custom panel view with several cat images and alt texts

CLI command

I also included an alter:generate CLI command that uses the Claude API to generate alt texts for your images.

  • Supports multi-language installations and only uploads the image for the default language and then translates the generated alt text to the other languages
  • Detects duplicate images and saves tokens by only uploading them once, updating all instances at once

Screenshot of a terminal displaying output from "kirby alter:generate"

CLI Arguments

  • --prompt / -p - Custom prompt for generating alt texts (default: "You are an accessibility expert writing alt text. Write a concise, short description in one to three sentences. Start directly with the subject - NO introductory phrases like "image of", "shows", "displays", "depicts", "contains", "features" etc. Return the alt text only, without any additional text or formatting.")
  • --overwrite - Overwrite existing alt texts (default: false)
  • --dry-run - Preview changes without updating files (default: false)
  • --verbose - Show detailed progress information (default: false)
  • --page - Start from specific page URI, e.g. "blog" (optional)

Usage Examples

# Generate alt texts for all images
kirby alter:generate

# Preview changes without updating files (still uses the API)
kirby alter:generate --dry-run

# Generate with custom prompt
kirby alter:generate --prompt "My custom prompt"

# Process only images from a specific page and overwrite existing alt texts
kirby alter:generate --page "blog/my-article" --overwrite

Options

// site/config/config.php
<?php

return [
	'medienbaecker.alter' => [
		'apiKey' => 'your-claude-api-key', // Set your Claude API key here
	]
];

Get your Claude API key from the Anthropic Console.

Installation

composer require medienbaecker/kirby-alter