Forum

Thread tagged as: Problem, Addons, Redactor

Resizing images in Redactor

I've upgraded to the Redactor II plugin for creating blog posts but can't work out how to enable it to resize images. I've updated the _config.inc file to enable the setting for both imageResizable and imagePosition but this doesn't seem to do anything. Does anyone know how to enable this feature?

Here's my updated _config.inc

<script type="text/javascript" src="PERCH_LOGINPATH/addons/plugins/editors/redactor/redactor.min.js?v=1.2.5"></script>
<link rel="stylesheet" href="PERCH_LOGINPATH/addons/plugins/editors/redactor/perch/edit.css?v=1.2.5" type="text/css" />
<link rel="stylesheet" href="PERCH_LOGINPATH/addons/plugins/editors/redactor/redactor.min.css?v=1.2.5" type="text/css" />

<!-- Plugins -->
<script type="text/javascript" src="PERCH_LOGINPATH/addons/plugins/editors/redactor/plugins/source.js"></script>
<script type="text/javascript" src="PERCH_LOGINPATH/addons/plugins/editors/redactor/plugins/video.js"></script>

<script type="text/javascript" charset="utf-8">
$(function() {
    var set_up_redactor = function() {
        $('textarea.redactor:not([data-init])').each(function(i,o){
            var self = $(o);
            var uploadFields = {
                    'width'  :  self.attr('data-width')||'',
                    'height' :  self.attr('data-height')||'',
                    'crop'   :  self.attr('data-crop')||'',
                    'quality':  self.attr('data-quality')||'',
                    'sharpen':  self.attr('data-sharpen')||'',
                    'density':  self.attr('data-density')||'',
                    'bucket' :  self.attr('data-bucket')||'default'

                };
            self.wrap('<div class="editor-wrap" style="float:left;"></div>');
            self.redactor({
                imageUpload: 'PERCH_LOGINPATH/addons/plugins/editors/redactor/perch/upload.php?filetype=image',
                fileUpload: 'PERCH_LOGINPATH/addons/plugins/editors/redactor/perch/upload.php',
                fileUploadFields: uploadFields,
                imageUploadFields: uploadFields,
                imageResizable: true,
                imagePosition: true,
                plugins: ['source', 'video'] // Plugins
            });
            self.attr('data-init', true);
        });
    };

    set_up_redactor();

    $(window).on('Perch_Init_Editors', function(){
        set_up_redactor();
    });

});
</script>
Damian Lewis

Damian Lewis 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It looks like it should work on the face of it. Have you checked it's not just caching?

Yes, I've cleared the cache. When I click on an image in the redactor window I just get a modal with the fields to edit the title, caption, link and buttons to Save, Cancel or Delete.

Not sure how to get this to work. The _config.inc file I've edited is located in the 'addons/plugin/editors/redactor' folder.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, ok. It needs to be addons/plugins/editors/redactor/_config.inc instead.

Sorry, that was a typo, .../plugin/... should have been .../plugins/.... So it is the addons/plugins/editors/redactor/_config.inc that I've been editing.

Drew McLellan

Drew McLellan 2638 points
Perch Support

In that case I'm not sure - you may want to check out the Redactor information on the subject.