0

我使用了 trumbowyg 插件。在图片上传选项中,我正在尝试设置默认高度和宽度,下面是我的代码

$('#editor, #editor1, #editor2, #editor3, #editor4,#explain').trumbowyg({

            btnsDef: {
                image: {
                    dropdown: ['upload'],
                    ico: 'insertImage'
                }
            },
            btns: [
            ['viewHTML'],
            ['formatting'],
            ['strong'],
            ['image'],
            ['justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull'],
            ['unorderedList', 'orderedList'],
            ['fullscreen'],
            ['mathml'],
            ],
            
        

            plugins: {
            upload: {
            serverPath: 'upload.php',
            fileFieldName: 'image',
            urlPropertyName: 'href',
             success: function (data, trumbowyg, $modal, values) {
                 if(data.name) {
                            if(data.type == 'image') {
                                trumbowyg.execCmd("insertImage",data.href , !1, !0);
                                var v=$('img[src="' + data.href + '"]:not([alt])', trumbowyg.$box);
                                v.attr('alt', values.alt);
                                v.attr('width', '100px');
                                v.attr('height', '100px');
                                trumbowyg.closeModal()

                            }
                 }  
                 else
                 {
                     alert(data.error_msg);
                     trumbowyg.closeModal()

             }

             },
              error: function (data) {
                      alert(data);
                    }

        }
    }
        });

但是在php中提交表单时无法获得宽度和高度值。有人可以建议我怎么做。

4

0 回答 0