    <script>
        tinymce.init({
            selector:'#description', 
            relative_urls: false,
            height: 400,
            menubar: false,  
            toolbar: 'imageupload undo redo | insert | styleselect | forecolor fontsizeselect fontselect backcolorbold italic | link alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | media image table directionality | removeformat | code',
            plugins: [
              'advlist autolink lists link image charmap print preview anchor',
              'searchreplace visualblocks code fullscreen',
              'insertdatetime media table paste code',
              'wordcount textcolor',
            ], 
            fontsize_formats: '8pt 10pt 12pt 14pt 18pt 24pt 36pt',
            font_formats: 'Arial=arial,helvetica,sans-serif;Courier New=courier new,courier,monospace;AkrutiKndPadmini=Akpdmi-n',
            content_css: '//www.tinymce.com/css/codepen.min.css',
            setup: function(editor) {
                initImageUpload(editor);
            }
        });
        function initImageUpload(editor) {
          // create input and insert in the DOM
          var inp = $('<input id="uploader" type="file" name="pic" accept="image/*" style="display:none">');
          $(editor.getElement()).parent().append(inp);
        
          // add the image upload button to the editor toolbar
          editor.addButton('imageupload', {
            text: '',
            icon: 'image',
            onclick: function(e) { // when toolbar button is clicked, open file select modal
              inp.trigger('click');
            }
          });
        
          // when a file is selected, upload it to the server
          inp.on("change", function(e){
            uploadFile($(this), editor);
          });
        }
        function uploadFile(inp, editor) {
              var input = inp.get(0);
              var data = new FormData();
              // data.append('image[file]', input.files[0]);
              // data.append('image[file]', $("#uploader")[0].files[0]);
              data.append('image', $("#uploader")[0].files[0]);
              //data.append('username', 'DMZ');
              // console.warn($("#uploader")[0].files[0]);
              console.warn(data);
              swal({
                title: "",
                text: "La iamgen esta siendo cargada, espere un momento por favor.",
                imageUrl: "http://machareti-ivo.org/assets/img/loading.gif",
                showConfirmButton: false
                });
            
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                }
            });
                
              $.ajax({
                url: '/uploadImage',
                type: 'POST',
                data: data,
                processData: false, // Don't process the files
                contentType: false, // Set content type to false as jQuery will tell the server its a query string request
                success: function(data, textStatus, jqXHR) {
                    console.log(data);
                    //console.log(JSON.stringify(data));
                  editor.insertContent('<img class="content-img-upload" src="' + data + '"/>');
                    swal.close()
                },
                error: function(jqXHR, textStatus, errorThrown) {
                  if(jqXHR.responseText) {
                    errors = JSON.parse(jqXHR.responseText).errors
                    alert('Error uploading image: ' + errors.join(", ") + '. Make sure the file is an image and has extension jpg/jpeg/png.');
                  }
                }
          });
        }
    </script>