Skip to content

Feature: Add Cloudflare image format setting#24

Open
roboes wants to merge 2 commits into
apeschar:masterfrom
roboes:master
Open

Feature: Add Cloudflare image format setting#24
roboes wants to merge 2 commits into
apeschar:masterfrom
roboes:master

Conversation

@roboes

@roboes roboes commented May 27, 2026

Copy link
Copy Markdown

Description

PhastPress counterpart to kiboit/phast#22, which contains the full context and core logic.

Adds an img-cloudflare-format setting (off / webp / avif) to the WordPress admin panel, allowing users to configure modern image format serving behind Cloudflare. Defaults to off, preserving existing behaviour.

Changes

  • PluginConfiguration::getDefaultAdminPanelSettings() - adds 'img-cloudflare-format' => 'off'.
  • PhastConfiguration::get() and getForHTMLSnippets() - maps the setting to $phastConfig['images']['cloudflare-image-format'].
  • Translations::DATA - adds UI label, per-option descriptions, and a tip linking to the Cloudflare Vary for Images documentation.
  • Translations::__construct() - fixes PHP 8.1+ deprecation: isset() was called with $this->locale (which is null before assignment) as the array offset; changed to use the $locale parameter instead. No behavior change; compatible with PHP 7.4-8.5.

Notes

The PHP side is complete. For the admin panel UI, the Vue source appears to live in a private SDK repo not accessible from the public phast or phastpress repos.

To render the img-cloudflare-format setting as a three-option select (off / webp / avif), a new Vue component would be needed. Two options to consider:

  1. If the SDK source can be shared or the maintainer can add a select component, a three-option dropdown would give the cleanest UX.
  2. Alternatively, two boolean toggles (img-cloudflare-webp and img-cloudflare-avif) could replace the single select - this fits the existing UI without any new components.

Happy to go either way, but would need guidance or access to the SDK source to proceed with option 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant