Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.6.17 Update released for Drupal core (10.6.17)! Release: Drupal 11.3.17 Update released for Drupal core (11.3.17)! Release: Drupal 11.4.7 Update released for Drupal core (11.4.7)! Release: Editor Advanced Image 3.1.5 Minor update available for module editor_advanced_image (3.1.5). Release: Bamboo Twig 6.0.9 Minor update available for module bamboo_twig (6.0.9). Release: Shortcode Gmap 3.0.0 Major update available for module shortcode_gmap (3.0.0). Release: Single directory component Embed 1.2.0 Minor update available for module sdc_embed (1.2.0). Release: Seeds - Drupal Starter Kit 13.1.3 Minor update available for distribution seeds (13.1.3). Usage Milestone: Schemata Module schemata crossed 1,000 active installs. Module Revived: Cookie Condition 2.0.2 Module cookie_condition updated after 18 months of inactivity (2.0.2).

This module automatically enhances images inserted into CKEditor 5 for use in decoupled Drupal frontends. It converts standard `<img>` tags to `<picture>` elements, offering AVIF and WebP formats for better performance, and rewrites relative image URLs to absolute ones. This ensures images display correctly and load efficiently on any frontend domain without requiring editorial workflow changes or JavaScript.

Automatically converts CKEditor 5 inline images into responsive
elements with AVIF and WebP sources, and rewrites relative
URLs to absolute — built for headless and decoupled Drupal frontends.

When you build a decoupled Drupal site (React, Next.js, Astro, etc.), images inserted directly via CKEditor 5 are stored with
root-relative URLs (/sites/default/files/…) and plain <img> tags. These break on a frontend served from a
different domain, and they miss the performance benefits of modern formats like AVIF and WebP.

CKEditor Picture fixes this automatically at the text-processing layer: no editorial workflow changes required, no JavaScript, no
CDN dependency.

Features

  • Converts CKEditor 5 direct file-upload <img> tags into <picture> elements with AVIF and WebP
    <source> alternatives.
  • Rewrites root-relative src attributes to absolute URLs so decoupled frontends on any domain can load the image.
  • Preserves <figure>, <figcaption>, alignment classes, alt, width,
    height, and loading attributes — nothing is lost.
  • Graceful degradation: if a format is not supported by the image toolkit, that <source> is silently omitted and the
    browser falls back to the next one.
  • Configurable image style names per text format via the standard Text formats admin UI.
  • Automatically enables itself on all non-plain-text formats on install.
  • Works transparently with JSON:API and REST — the transformation happens in body.processed, so no frontend code
    changes are needed.

Post-Installation

Run:

  drush en ckeditor_picture
  drush updb
  drush cr
  

That's it. The module adds itself to every HTML text format automatically. To verify or change settings, go to:

Administration → Configuration → Content authoring → Text formats

Select a format (e.g. Full HTML), find the "CKEditor inline images →
AVIF/WebP"
filter, and configure the AVIF
and WebP image style machine names (defaults: body_avif and body_webp).

Both image styles are created on install. You can adjust their effects at:

Administration → Configuration → Media → Image styles

Additional Requirements

  • Drupal 10.1 or 11
  • CKEditor 5 (included in Drupal core)
  • An image toolkit that supports AVIF and/or WebP:
    • GD: requires PHP compiled with --with-avif (PHP 8.1+) for AVIF; WebP support is standard in
      most PHP builds.
    • ImageMagick: requires libavif for AVIF; WebP is widely available.

If the toolkit does not support a format, that <source> is omitted and the browser uses the next available source.

  • ImageMagick: broader AVIF and WebP support than GD, and better
    performance for large images.
  • Responsive Image (Drupal core): handles <picture> for Media Library embeds
    (<drupal-media> tags). CKEditor Picture complements it by covering direct file-upload <img> tags, which
    Responsive Image does not process.

Similar projects

  • WebP: converts images sitewide via image styles but does not target CKEditor
    inline images or produce <picture> elements for decoupled consumers.
  • Responsive Image (core): generates <picture> for Media Library embeds using responsive image
    styles, but only for <drupal-media> entities — not for images uploaded directly via CKEditor's file upload button.

CKEditor Picture is specifically designed for the direct-upload use case in decoupled architectures, where the
body.processed field is consumed by an external frontend.

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
1
Tracked since
Jun 2026
Latest release
2 months ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.x-dev Dev 10–11 Jun 19, 2026