Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CKEditor
$scope.editorOptions = {
language: 'en',
'skin': 'moono',
'extraPlugins': "imagebrowser,mediaembed",
imageBrowser_listUrl: '/api/v1/ckeditor/gallery',
filebrowserBrowseUrl: '/api/v1/ckeditor/files',
filebrowserImageUploadUrl: '/api/v1/ckeditor/images',
filebrowserUploadUrl: '/api/v1/ckeditor/files',
toolbarLocation: 'bottom',
toolbar: 'full',
toolbar_full: [
{ name: 'basicstyles',
items: [ 'Bold', 'Italic', 'Strike', 'Underline' ] },
{ name: 'paragraph', items: [ 'BulletedList', 'NumberedList', 'Blockquote' ] },
{ name: 'editing', items: ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock' ] },
{ name: 'links', items: [ 'Link', 'Unlink', 'Anchor' ] },
{ name: 'tools', items: [ 'SpellChecker', 'Maximize' ] },
{ name: 'clipboard', items: [ 'Undo', 'Redo' ] },
{ name: 'styles', items: [ 'Format', 'FontSize', 'TextColor', 'PasteText', 'PasteFromWord', 'RemoveFormat' ] },
{ name: 'insert', items: [ 'Image', 'Table', 'SpecialChar', 'MediaEmbed' ] },'/',
]
};
$rel = '/assets/img/wysiwyg';
$dir = public_path() . '/assets/img/wysiwyg';
$iterator = $this->finder->in($dir)->name('*.png')->name('*.jpg');
$files = [];
$count = 0;
foreach($iterator as $file) {
$files[$count]['thumb'] = $rel . '/' . $file->getFilename();
$files[$count]['image'] = $rel . '/' . $file->getFilename();
$files[$count]['title'] = $file->getFilename();
$count ++;
}
return Response::json($files);
$rel = '/assets/files/wysiwyg';
$dir = public_path() . $rel;
$_FILES['upload']['type'] = strtolower($_FILES['upload']['type']);
if ($_FILES['upload']['type'] == 'application/pdf'
|| $_FILES['upload']['type'] == 'image/jpg'
|| $_FILES['upload']['type'] == 'image/gif'
|| $_FILES['upload']['type'] == 'image/jpeg'
|| $_FILES['upload']['type'] == 'application/doc')
{
$tmp = $_FILES['upload']['tmp_name'];
$dest = $dir . '/' . $_FILES['upload']['name'];
$this->filesystem->copy($tmp, $dest, $override = TRUE);
$file = '/assets/files/wysiwyg/'.$_FILES['upload']['name'];
}
$funcNum = $_GET['CKEditorFuncNum'];
$message = "File uploaded";
$script = "<script type='text/javascript'>window.parent.CKEDITOR.tools.callFunction(\"$funcNum\", \"$file\", \"$message\");</script>";
return $script;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.