How can one modify the image picker in ckeditor?

Hi, is it possible to modify the output of the image picker in ckeditor?
Would be nice if there was a service/interface you could decorate, or similar :slight_smile:

Litium version: 8.7.2

Image in CKEditor works just like other images in the system. If you want to control how to resize images, checkout the Image resizer.

Alright. I’ve already fixed the images on the site (for example images in razor views), but for some reason the images outputted by the editor always came back with the default format.

My logic depends on the Accept header, and as the request to get the image url in the editor doesn’t know about the user’s Accept header, the wrong image url will be outputted.

I’m decorating MediaLocationService to add custom data if the Accept header matches my query, which I then use to determine if the image should be using my resizer or not.

Can you describe more what you try to achieve, maybe we have other suggestions to solving your problem.

I wanted to convert images to webp if the request accepts webp formats. My first solution involved decorating MediaLocationService to generate a new image url. This is actually not needed, as you can access the actual request headers in DownloadControllerBase.

To “override” the BlobDownloadController, you’d have to unregister the controller in Startup, using a custom FeatureProvider, and then creating a similar controller with the same route as in BlobDownloadController.

Some properties in StorageRequestContext is internal or only have internal setters, so you’d have to use reflection to set some required properties, which might not be recommended, but the only way I could solve it.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.