i have trouble editing my image properties after uploading it in ckeditor4, the image properties seems like been disabled? i can't click anything on high and width input box, or hspace ande vspace. the only thing that i can press are the cancel and save button. does anyone have the same issue? and perhaps the solution for it?.
here i attachthe code for my blade for the ckeditor,and my upload image in the controller
//code on my blade
<div class="form-group">
<label>Deskripsi</label>
<textarea type="text" name="deskripsi" class="form-control" placeholder="Deskripsi Item"> </textarea>
<script>
CKEDITOR.replace( 'deskripsi', { filebrowserUploadUrl: "", filebrowserUploadMethod: 'form',
filebrowserBrowseUrl : " type=2&editor=ckeditor&fldr=",
filebrowserImageBrowseUrl : "?type=1&editor=ckeditor&fldr=",
config.allowedContent = 'a[!href,target];img[src,alt,width,height]; span[*](*)',
});
</script>
</div>
public function uploadImage(Request $request)
{
if($request->hasFile('upload')) {
//get filename with extension
$fileNameWithExtension = $request->file('upload')->getClientOriginalName();
//get filename without extension
$fileName = pathinfo($fileNameWithExtension, PATHINFO_FILENAME);
//get file extension
$extension = $request->file('upload')->getClientOriginalExtension();
//filename to store
$fileNameToStore = $fileName.'_'.time().'.'.$extension;
//Upload File
$request->file('upload')->storeAs('public/uploads', $fileNameToStore);
$CKEditorFuncNum = $request->input('CKEditorFuncNum') ? $request->input('CKEditorFuncNum') : 0;
if($CKEditorFuncNum > 0){
$url = asset('storage/uploads/'.$fileNameToStore);
$msg = 'Image successfully uploaded';
$renderHtml = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>";
// Render HTML output
@header('Content-type: text/html; charset=utf-8');
echo $renderHtml;
} else {
$url = asset('storage/uploads/'.$fileNameToStore);
$msg = 'Image successfully uploaded';
$renderHtml = "<script>window.parent.CKEDITOR.tools.callFunction($CKEditorFuncNum, '$url', '$msg')</script>";
return response()->json([
'uploaded' => '1',
'fileName' => $fileNameToStore,
'url' => $url
]);
}
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire