I am working on a requirement of upload image in 'CKEditor' where the image that is uploaded should be below 2MB size. I am using 'CKFinder' for the image upload, I know that there is a 'maxSize' option for images in 'ckfinder\config.php' file, Initially maxSize=0 is there that I have changed it to '2000' and after that I tried to upload image above 2MB but still it is accepting that image to upload. I observed here what is happening whenever user uploads an image in CKEditor is It is doing image compression automatically and the 2MB or above image is getting compressed to KB's. Below is the code of config.php file:
ckeditor/ckfinder/config.php
$config['resourceTypes'][] = array(
'name' => 'Images',
'directory' => 'images',
'maxSize' => 2000,
'allowedExtensions' => 'bmp,gif,jpeg,jpg,png',
'deniedExtensions' => '',
'backend' => 'default'
);
ckeditor/config.js
CKEDITOR.editorConfig = function( config ) {
config.filebrowserBrowseUrl = "/ckeditor/ckfinder/ckfinder.html";
config.filebrowserImageBrowseUrl = "/ckeditor/ckfinder/ckfinder.html?type=Images";
config.filebrowserFlashBrowseUrl = "/ckeditor/ckfinder/ckfinder.html?type=Flash";
config.filebrowserUploadUrl = "/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Files";
config.filebrowserImageUploadUrl = "/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Images";
config.filebrowserFlashUploadUrl = "/ckeditor/ckfinder/core/connector/php/connector.php?command=QuickUpload&type=Flash";
config.language = "en";
config.uiColor = "#F7B42C";
config.height = 300;
config.toolbarCanCollapse = true
};
My questions here are, I am confused of whether 'maxSize' is in KB's or MB's in config.php file? how to restrict image maxSize to allow images equals to or below 2 MB in CKEditor? Any help would be appreciated. Thanks.