在tinymce编辑器中浏览图像的问题

时间:2012-12-06 14:46:02

标签: php image upload tinymce

我正在尝试在tinymce编辑器中实现照片上传选项。为此我已经上传了最新版本的ajaxfilemanager。我只是将文件夹放在tinymce的插件文件夹下。并在插件文件夹下再创建一个名为“uploaded”的文件夹。同时修改tinyMCE.init的代码,如

tinyMCE.init({
// General options
  mode : "textareas",
  elements : "ajaxfilemanager",
  theme : "advanced",
  plugins : "pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave,paste,fullscreen,noneditable,contextmenu",
    theme_advanced_buttons1_add_before : "newdocument,separator",
    theme_advanced_buttons1_add : "fontselect,fontsizeselect",
    theme_advanced_buttons2_add : "separator,forecolor,backcolor,liststyle",
    theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,",
    theme_advanced_buttons3_add_before : "tablecontrols,separator",
    theme_advanced_buttons3_add : "flash,advhr,separator,fullscreen",
    theme_advanced_toolbar_location : "top",
    theme_advanced_toolbar_align : "left",
    extended_valid_elements : "hr[class|width|size|noshade]",
    file_browser_callback : "ajaxfilemanager",
    paste_use_dialog : false,
    theme_advanced_resizing : true,
    theme_advanced_resize_horizontal : true,
    apply_source_formatting : true,
    force_br_newlines : true,
    force_p_newlines : false,
    relative_urls : true,


    // Example content CSS (should be your site CSS)
    // using false to ensure that the default browser settings are used for best Accessibility
    // ACCESSIBILITY SETTINGS
    content_css : false,
    // Use browser preferred colors for dialogs.
    browser_preferred_colors : true,
    detect_highcontrast : true,

    // Drop lists for link/image/media/template dialogs
    template_external_list_url : "lists/template_list.js",
    external_link_list_url : "lists/link_list.js",
    external_image_list_url : "lists/image_list.js",
    media_external_list_url : "lists/media_list.js",

    // Style formats
    style_formats : [
     {title : 'Bold text', inline : 'b'},
     {title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
     title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
     {title : 'Example 1', inline : 'span', classes : 'example1'},
     {title : 'Example 2', inline : 'span', classes : 'example2'},
     {title : 'Table styles'},
     {title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
    ],

    // Replace values for the template plugin
    template_replace_values : {
     username : "Some User",
     staffid : "991234"
    }
    });
function ajaxfilemanager(field_name, url, type, win) {
    var ajaxfilemanagerurl = "../tinymce/jscripts/tiny_mce/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=tinymce";
    switch (type) {
        case "image":
            break;
        case "media":
            break;
        case "flash":
            break;
        case "file":
            break;
        default:
            return false;
    }
    var fileBrowserWindow = new Array();
    fileBrowserWindow["file"] = ajaxfilemanagerurl;
    fileBrowserWindow["title"] = "Ajax File Manager";
    fileBrowserWindow["width"] = "782";
    fileBrowserWindow["height"] = "440";
    fileBrowserWindow["close_previous"] = "no";
    tinyMCE.openWindow(fileBrowserWindow, {
      window : win,
      input : field_name,
      resizable : "yes",
      inline : "yes",
      editor_id : tinyMCE.getWindowArg("editor_id")
    });

    return false;
}

此外,我修改了ajaxfilemanager/inc文件夹下的config.base.php文件。

define('CONFIG_SYS_DEFAULT_PATH', 'http://localhost/object/all/tinymce/jscripts/tiny_mce/plugins/uploaded/'); //accept relative path only
define('CONFIG_SYS_ROOT_PATH', 'http://localhost/object/all/tinymce/jscripts/tiny_mce/plugins/uploaded/');  //accept relative path only

但是我无法打开浏览窗口。 你能指导我解决这个问题吗?

我解决了一些js错误。现在我弹出了图像,可以上传一些图像。但每当我尝试获取图片网址时,它都会在图片网址fext-field中显示undefined。 现在请帮助我如何继续。

0 个答案:

没有答案