Resize ckfinder image

After selecting or loading an image using ckfinder, the user can change the width and height. I want it to automatically resize the image to the width and height that the user sets. Is it possible?

I noticed that ajax image resizer will fix this, but cannot make it work. Does anyone have any experience with automatic sizing and width widths?

In my ckfinder configuration file, I have:

include_once "plugins/imageresize/plugin.php"; 

in config.js I have:

 CKFinder.customConfig = function( config ) { config.extraPlugins = 'imageresize'; }; 
+6
image resize ckfinder
source share
3 answers

In the past, I predefined the auto-resize value for a specific folder in ckFinder to change any image that a user uploads to that folder. I do this by adding a little code to the config.php file as follows:

 // This next block sets the default max image size and quality $config['Images'] = Array( 'maxWidth' => 1600, 'maxHeight' => 1200, 'quality' => 80); // Here we override those settings for a given folder if(isset($_GET['currentFolder']) && urldecode($_GET['currentFolder']) == '/some-folder-name/'){ $config['Images']['maxWidth'] = 150; $config['Images']['maxHeight'] = 150; } 

I would suspect that you can do a similar hack, perhaps using the values ​​of $ _SESSION. Ask the user to select the auto-resize values ​​they need and save them in their $ _SESSION. Then, in your configuration file, find this session value. Something like:

 if(isset($_SESSION['resize_w']) && isset($_SESSION['resize_h']) ){ $config['Images']['maxWidth'] = $_SESSION['resize_w']; $config['Images']['maxHeight'] = $_SESSION['resize_h']; } 

Note that you will need to call session_start () in the config.php file if you have not already done so.

+3
source share

Ckeditor does not resize the image; it only resizes the height and width. instead of resizing the image. Set the default width and height by clicking the OK button. Here I replace the user-entered height and width defaults for height and width.

  CKEDITOR.on('dialogDefinition', function (ev) { var dialogName = ev.data.name, dialogDefinition = ev.data.definition; if (dialogName == 'image') { var onOk = dialogDefinition.onOk; dialogDefinition.onOk = function (e) { var width = this.getContentElement('info', 'txtWidth'); width.setValue('200');//Set Default Width var height = this.getContentElement('info', 'txtHeight'); height.setValue('200');//Set Default height onOk && onOk.apply(this, e); }; } }); 
0
source share

In the "config.ascx" file, change the value of the variable as

 Images.MaxWidth = 0; Images.MaxHeight = 0; Images.Quality = 100; 
0
source share

All Articles