Inserting an image in the text editor dialog today allows the user to fiddle with image dimensions. It doesn't even have aspect ratio locking.

It's not great for the authoring experience nor for structured content reasons that users are defining the specific dimensions of every single image they insert. It'd be much better to allow them to choose from image styles — just like we do for image fields.

This module lets users select a responsive style OR a image style to place images in the content.

Credits

This module is essentially a stand alone version of the patch in this issue:
#2061377: [drupalImage] Optionally apply image style to images uploaded in CKEditor 5
When that patch makes it in into core, this module is no longer needed.

We would like to credit the original authors of that patch: Wim Leers, mdrummond, Jelle_S, miraj9093, tonnosf, erik.erskine, dimaro, garphy, juancasantito.

Installation

  • Enable the module.
  • Add the text format filter (Display responsive images or Display image styles). Do not enable both for the same text format.
  • Select the styles you want to expose.
  • Note: either don't enable the Restrict images to this site and
    Track images uploaded via a Text Editor filters or make sure to change the
    order so the filters of this module run after those filters.
  • Create new content. In the editor, click on the
    image icon in the toolbar. A popup will open where the user can upload an
    image and assign an image style or responsive style by selecting style from
    the dropdown menu.

Drupal 10 & CKEditor 5

There is a 3.x-dev release that can be installed on Drupal 10 and has CKEditor 5 support. CKEditor 4 will be supported as long as the contrib module is supported. Please test the dev version and leave feedback in the issue tracker. We would like to release a stable version soon.

Project information

Releases