Drupal is a registered trademark of Dries Buytaert
Release: Drupal 10.3.6 Update released for Drupal core (10.3.6)! Release: Drupal 11.0.5 Update released for Drupal core (11.0.5)! Release: Drupal 10.2.9 Update released for Drupal core (10.2.9)! Release: Drupal 10.2.10 Update released for Drupal core (10.2.10)! Release: Drupal 10.3.7 Update released for Drupal core (10.3.7)! Release: Drupal 11.0.6 Update released for Drupal core (11.0.6)! Release: Drupal 10.3.8 Update released for Drupal core (10.3.8)! Release: Drupal 11.0.7 Update released for Drupal core (11.0.7)! Module Revived: Translation Management Tool 8.x-1.19 Module tmgmt updated after 7 months of inactivity (8.x-1.19). Usage Milestone: Account field split Module account_field_split crossed 10,000 active installs.

Consumer Image Styles integrates with JSON:API to provide image styles to your images in your decoupled project. Use this module if you need image styles when working with decoupled Drupal using the JSON API module.

📖 Read the article 📖

What version?

Use version 3.x with the latest JSON:API 2.x. Use 2.x for the legacy JSON:API 1.x.

When should I use this module

This is a lower budget alternative to services like Cloudinary, Akamai Image Converter, etc. This module will cover your needs in 90% of the decoupled projects.

Usage

  1. Register your consumer in /admin/config/services/consumers. A consumer is something like Marketing Vue.js Site, iOS application, …
  2. Select the image styles from your site applicable to the consumer.
  3. Identify your JSON API requests according to the documentation in the Consumers project (or use a dafault consumer as introduced in drupal/consumers@^1.7)

The will be a derivatives section in the meta for your image files in JSON API. Something like:

…
  "meta": {
    "imageDerivatives": {
      "links": {
        "medium: {
          "href": "http://example.org/sites/…/medium/…/img.png?itok=LQM1dnmK",
          "meta": {
            "rel": [
                "drupal://jsonapi/extensions/consumer_image_styles/links/relation-types/#derivative"
            ]
          }
        },
      }
    }
  }
…

Image Styles at the Field Level

In 3.x we changed the output a bit and introduced the concept of image styles at the field item level. To enable them you'll need to configure the image field you want image styles on using JSON:API Extras. This will also give you the ability to further refine the image styles for that particular field (on top of the ones selected at the consumer level).

Contenta CMS

This module is part of the Contenta CMS decoupled distribution and integrates with Contenta JS. Learn more about these projects:

👉 Contenta CMS 👈
🔥 Contenta JS 🔥

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
2
Tracked since
Oct 2024
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 2
Maintenance
Dormant

Releases

Version Type Core Release date
4.0.10 Stable Oct 15, 2024
4.0.9 Stable Oct 10, 2024