我正在'CKEditor'中上傳圖片的要求,上傳的圖片的大小應小於2MB。我使用'CKFinder'進行圖片上傳,我知道'ckfinder \ config.php'文件中有一個'maxSize'選項,最初maxSize = 0是我已經將它改爲'2000',之後我試圖上傳2MB以上的圖片,但它仍然接受要上傳的圖片。我在這裏觀察到,當用戶在CKEditor中上傳圖像時發生了什麼?它正在自動進行圖像壓縮,並且2MB或更高的圖像被壓縮爲KB。下面是config.php文件的代碼:如何在CKEditor中限制圖片上傳maxsize爲2MB?
的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
};
我的問題是在這裏,我很困惑是否'maxSize'在config.php文件中的KB或MB中?如何在CKEditor中限制圖像maxSize以允許圖像等於或低於2 MB?任何幫助,將不勝感激。謝謝。