Hello!
I am using the CKEditor with the elFinder.
When I upload an image from the elFinder i want to change the default width and height of the image properties to 100% automatically.
<script>
function getUrlParam(paramName) {
var reParam = new RegExp('(?:[\?&]|&)' + paramName + '=([^&]+)', 'i') ;
var match = window.location.search.match(reParam) ;
return (match && match.length > 1) ? match[1] : '' ;
}
$(function(){
var funcNum = getUrlParam('CKEditorFuncNum');
var elf = $('#elfinder').elfinder({
url : 'admin.php?mod=system&op=getFileManagerConnector',
getFileCallback : function(fileUrl) {
window.opener.CKEDITOR.tools.callFunction(funcNum,fileUrl, function(){
var widthField,heightField,urlField,
dialog = this.getDialog(),
width = height = '100%';
if (dialog.getName() == 'image')
{
widthField = dialog.getContentElement( 'info', 'txtWidth' );
heightField = dialog.getContentElement( 'info', 'txtHeight' );
urlField = dialog.getContentElement( 'info', 'txtUrl' );
if (urlField)
urlField.setValue(fileUrl);
if (widthField)
widthField.setValue(width);
if (heightField)
heightField.setValue(height);
}
return false;
});
window.close();
},
}).elfinder('instance');
});
</script>
Any ideas why this code doesn't work?
If i don't set the urlField , the width and height are set to 100%, but the urlField is empty,
It is supposed to work automatically , right?
Thanks in advance...
