---
title: "Controllers API"
manual: "RTE CKEditor Image"
version: "main"
permalink: "https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-controllers@main"
source: "API/Controllers.rst"
rendered: "2026-10-01T01:27:51+00:00"
---

# Controllers API {#api-controllers}

Controllers handle HTTP requests in the backend and bridge TypoScript to the service architecture.

**Table of contents**

-   [SelectImageController](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:selectimagecontroller@main)
-   [ImageRenderingAdapter](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:imagerenderingadapter@main)
-   [Service configuration](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:service-configuration@main)
-   [Migration from legacy controllers](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:migration-from-legacy-controllers@main)
-   [Related documentation](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:related-documentation@main)

<!-- TODO: no Markdown rendering for "versionchanged" -->

The legacy ImageRenderingController and ImageLinkRenderingController were removed
and replaced with ImageRenderingAdapter using the new service architecture.
See Services API for the new service-based approach.

## SelectImageController {#api-selectimagecontroller}

-   **class SelectImageController**

    -   *Fully qualified name:* `\Netresearch\RteCKEditorImage\Controller\SelectImageController`

    Main controller for image selection and processing in the CKEditor context.

    -   *Backend Route:* `rteckeditorimage_wizard_select_image` → `/rte/wizard/selectimage`

### Methods {#methods}

#### mainAction() {#mainaction}

-   **mainAction(ServerRequestInterface $request) : ResponseInterface**

    Entry point for the image browser/selection interface.

    -   *param ServerRequestInterface $request:* PSR-7 server request with query parameters.
    -   *returntype:* ResponseInterface

    *Returns:* PSR-7 response with file browser HTML.

**Query parameters:**

-   `mode`: Browser mode (default: `file` from route configuration).
-   `bparams`: Browser parameters passed to file browser.

**Usage example:**

**CKEditor plugin integration**

```javascript
// Called from CKEditor plugin
const contentUrl = routeUrl + '&contentsLanguage=en&editorId=123&bparams=' + bparams.join('|');
```

#### infoAction() {#infoaction}

-   **infoAction(ServerRequestInterface $request) : ResponseInterface**

    Returns JSON with image information and processed variants.

    -   *param ServerRequestInterface $request:* Server request with file identification and processing parameters.
    -   *returntype:* ResponseInterface

    *Returns:* JSON response with image data.

**Query parameters:**

-   `fileId`: FAL file UID.
-   `table`: Database table (usually `sys_file`).
-   `P[width]`: Desired width (optional).
-   `P[height]`: Desired height (optional).
-   `action`: Action type (`info`).

**Response structure:**

**Image info API response**

```json
{
  "uid": 123,
  "url": "/fileadmin/user_upload/image.jpg",
  "width": 1920,
  "height": 1080,
  "title": "Image title",
  "alt": "Alternative text",
  "processed": {
    "url": "/fileadmin/_processed_/image_hash.jpg",
    "width": 800,
    "height": 450
  },
  "lang": {
    "override": "Override %s",
    "overrideNoDefault": "Override (no default)",
    "zoom": "Zoom",
    "cssClass": "CSS Class"
  }
}
```

## ImageRenderingAdapter {#api-imagerenderingadapter}

<!-- TODO: no Markdown rendering for "versionadded" -->

Replaces the legacy ImageRenderingController and ImageLinkRenderingController.

-   **class ImageRenderingAdapter**

    -   *Fully qualified name:* `\Netresearch\RteCKEditorImage\Controller\ImageRenderingAdapter`

    TypoScript adapter bridging `preUserFunc` to the modern service architecture.

The adapter serves as a thin layer between TypoScript's `preUserFunc` interface and the
service-based architecture. It delegates actual processing to:

-   [ImageAttributeParser](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-imageattributeparser@main) \- HTML parsing.
-   [ImageResolverService](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-imageresolverservice@main) \- Business logic and security.
-   [ImageRenderingService](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-imagerenderingservice@main) \- Fluid template rendering.

### Methods {#methods-1}

#### renderImageAttributes() {#renderimageattributes}

-   **renderImageAttributes($content, $conf)**

    Processes `<img>` tags in RTE content using the service pipeline.

    -   *param string $content:* Current HTML content (single `<img>` tag).
    -   *param array $conf:* TypoScript configuration.
    -   *returntype:* string

    *Returns:* Processed HTML with updated image URL and attributes.

**Processing pipeline:**

1.  `ImageAttributeParser` extracts data attributes from HTML.
1.  `ImageResolverService` resolves FAL file, applies security checks, processes image.
1.  `ImageRenderingService` renders via Fluid template.

**TypoScript integration:**

**Image tag processing configuration**

```typoscript
lib.parseFunc_RTE {
    tags.img = TEXT
    tags.img {
        current = 1
        preUserFunc = Netresearch\RteCKEditorImage\Controller\ImageRenderingAdapter->renderImageAttributes
    }
}
```

#### renderInlineLink() {#renderinlinelink}

-   **renderInlineLink($content, $conf, $request)**

    Renders inline links: resolves `t3://` URLs and validates protocols.
    Since `parseFunc` processes tags depth-first (inner first), `tags.img`
    fires before `tags.a`, so this handler receives already-processed image
    content and only needs to reconstruct the `<a>` wrapper.

    -   *param string|null $content:* Content input (not used).
    -   *param array $conf:* TypoScript configuration.
    -   *param ServerRequestInterface $request:* Current request.
    -   *returntype:* string

    *Returns:* Rendered HTML with link wrapper.

**TypoScript integration:**

**Link processing configuration**

```typoscript
lib.parseFunc_RTE {
    tags.a = TEXT
    tags.a {
        current = 1
        preUserFunc = Netresearch\RteCKEditorImage\Controller\ImageRenderingAdapter->renderInlineLink
    }
}
```

## Service configuration {#service-configuration}

All controllers are configured in `Configuration/Services.yaml`:

**EXT:rte_ckeditor_image/Configuration/Services.yaml**

```yaml
Netresearch\RteCKEditorImage\Controller\SelectImageController:
  tags: ['backend.controller']

Netresearch\RteCKEditorImage\Controller\ImageRenderingAdapter:
  public: true
```

Controllers use constructor injection for dependencies.

## Migration from legacy controllers {#migration-from-legacy-controllers}

<!-- TODO: no Markdown rendering for "versionchanged" -->

If you were extending the legacy controllers via XCLASS, migrate to:

1.  **Template overrides** (recommended): Override Fluid templates in your site package.
    See [Template Overrides](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:examples-template-overrides@main).
1.  **Service decoration**: Decorate `ImageResolverService` or `ImageRenderingService`.
    See [Services API](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-services@main).

The TypoScript interface remains 100% backward compatible - no changes required for standard usage.

## Related documentation {#related-documentation}

-   [Services API](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-services@main) \- New service architecture.
-   [DTOs](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:api-dtos@main) \- Data transfer objects.
-   [Template Overrides](https://docs.typo3.org/permalink/netresearch/rte-ckeditor-image:examples-template-overrides@main) \- Customizing output.
