1

I'm trying to develop a blog style website and I use Django as web framework, CKeditor as wygiwys and Filer for file management (linked with CKeditor with django-ckeditor-filebrowser-filer).
It's all working, but the problem is that I can't control the image size for the images used inside the posts, I'd like to serve them based on user's device (smaller on mobile, larger on desktop, etc..).
I have no idea how to do that, any ideas? thanks

EDIT:
An idea would be: the CKeditor makes the html block and then send it to the client with the filer image src (like 'media/uploads/46813413/12'), then again from the server intercept the request to the filer media and send a resized image based on the the device that made the request. But is it possible to manage the filer requests?

  • Hi Davide, what have you attempted so far for controlling image sizes? Do you have any of your code you can share? – Eric Mar 19 '20 at 21:32
  • Hi! Right now i just serve the full size image to the client. For the images that are not in the post content i use easy_thumbnail, but it can't be used in the post content since CKeditor return a string of html code. I'm thinking about "intercepting" the user request to the filer resource and then give to the client a custom size image, but I don't know how to implement it (and if it's possible) – Davide Aimar Mar 19 '20 at 22:21

1 Answers1

0

This can be configured in the settings.py file. Specify the width & height as 100% like below,

CKEDITOR_CONFIGS = {
    'default': {
        'height': '100%',
        'width': '100%',
    },
}

If you want to more or less height, you can use like 'height': '200'.

You can do much more configuration with ckeditor, refer to official documentation

Gokul nath
  • 494
  • 2
  • 8
  • 17