Django ckeditor图像压缩到Jpeg和图像调整大小

问题描述

我正在尝试使用模型中的RichTextUploadingField做几件事。谁能帮我这个忙吗?

  1. 将django ckeditor压缩为jpeg,以节省磁盘空间。 为此,我在 CKEDITOR_FORCE_JPEG_COMPRESSION设置 django-ckeditor github页面,但它抛出了我错误

    NameError:名称'CKEDITOR_FORCE_JPEG_COMPRESSION'未定义

  2. 我想设置认的django ckeditor上传的图像大小,假设是否 我上传了1000px的图片,它应该会自动转换为600或 500像素而不会影响图像质量或图像(如果可能) 调整大小选项,就像我们在单词中拖动和调整大小一样。 Ckeditor设置 配置:

Ckeditor配置:

CKEDITOR_UPLOAD_PATH = "uploads/"
CKEDITOR_IMAGE_BACKEND = "pillow"
CKEDITOR_FORCE_JPEG_COMPRESSION = True

    CKEDITOR_CONfigS = {
        'default': {
            'width': '100%','height': 600,'contentsCss': 'img {max-width: 100%;height: auto! important;}','toolbar': 'Custom','toolbar_Custom': [
                [
                    'Bold','Italic','Underline'
                ],[
                    'Font','FontSize','TextColor','BGColor','Find','Replace','-','SpellChecker'
                ],[
                    'NumberedList','BulletedList','Outdent','Indent','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock','Table','Tabletools'
                ],[
                    'Link','Unlink'
                ],[
                    'RemoveFormat','Source','Smiley','Image','Youtube','Preview'
                ]
            ],},}

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)