Back Home

Open Designs

Community. Driven.

    •  
      CommentAuthorperthmetro
    • CommentTimeMay 15th 2008 edited by perthmetro on the 15th May 2008 at 22:04:07 EDT
     
    I'm having a little problem...

    I'm using Niceditor (or TinyMCE)with NanoCMS and I want to be able to define within Niceditor (or TinyMCE) the image path url/folder for the location of the images to insert into a page. Confused? Let me explain some more...

    I want to be able to just write filename.jpg into Niceditor (or TinyMCE)'s image url box and the image will appear. No matter which folder the images are uploaded to I only want to have to type in filename.jpg .

    So therefore I want to be able to define within Niceditor (or TinyMCE) where it needs to look and define the path (whether that be in the root directory, or a sub/sub/sub directory or even a another domain all together!

    Thanks heaps for any and all help.

    Pete

    I want to stress I only want to have to type in filename.jpg and not images/filename.jpg in the url box.
    •  
      CommentAuthorperthmetro
    • CommentTimeMay 15th 2008
     
    OK, I'm 50% there... I've found the image url path in the JS file but in the input box it displays the whole prefix url path, I don't want that i want it to be blank
    • CommentAuthorwfiedler
    • CommentTimeMay 16th 2008
     
    Pete - NicEdit:

    Open nicEdit.js in a plain text editor.

    Look for this lines:

    var nicImageOptions = {
    buttons : {
    'image' : {name : 'Add Image', type : 'nicImageButton',
    tags : ['IMG']}
    }

    };

    var nicImageButton=nicEditorAdvancedButton.extend({addPane:function()
    {this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm(
    {"":{type:"title",txt:"Add/Edit Image"},src:{type:"text",txt:"URL",
    value:"http://",style:


    Change

    src:{type:"text",txt:"URL",value:"http://",style:

    in:

    src:{type:"text",txt:"URL", value:"",style:

    I tried it and it worked.

    In TinyMCE you will get crazy searching for this function....

    Wolfram
    •  
      CommentAuthorperthmetro
    • CommentTimeMay 16th 2008
     
    thanks wolfram i'll try it tonight
    •  
      CommentAuthorperthmetro
    • CommentTimeMay 16th 2008
     
    not working for me? All my images are in www.xyz.com/nanocms/images...
    here's my code...

    var nicImageOptions = {
    buttons : {
    'image' : {name : 'Add Image', type : 'nicImageButton', tags : ['IMG']}
    }

    };

    var nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Add/Edit Image"},src:{type:"text",txt:"URL",value:"",style:{width:"150px"}},alt:{type:"text",txt:"Alt Text",style:{width:"100px"}},align:{type:"select",txt:"Align",options:{left:"Left",right:"Right"}}},this.im)},submit:function(B){var C=this.inputs.src.value;if(C==""||C=="images/"){alert("You must enter a Image URL to insert");return false}this.removePane();if(!this.im){var A="javascript:nicImTemp();";this.ne.nicCommand("insertImage",A);this.im=this.findElm("IMG","src",A)}if(this.im){this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);
    • CommentAuthorwfiedler
    • CommentTimeMay 16th 2008
     
    And what about this:

    src:{type:"text",txt:"URL", value:"nanocms/images/",style:

    Then you only have to type after the default value in the field "yourimage.jpg".
    •  
      CommentAuthorperthmetro
    • CommentTimeMay 16th 2008
     
    but then the words nanocms/images/ appears in the text box and i don't want that.
    • CommentAuthorwfiedler
    • CommentTimeMay 16th 2008
     
    "You can't always get, what you want!" Sorry Pete - I have no idea! Any JS crack out there?
  1.  
    It's quite easy Pete, find:

    var nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Add/Edit Image"},src:{type:"text",txt:"URL",value:"http://",style:{width:"150px"}},alt:{type:"text",txt:"Alt Text",style:{width:"100px"}},align:{type:"select",txt:"Align",options:{left:"Left",right:"Right"}}},this.im)},submit:function(B){var C=this.inputs.src.value;if(C==""||C=="http://"){alert("You must enter a Image URL to insert");return false}this.removePane();if(!this.im){var A="javascript:nicImTemp();";this.ne.nicCommand("insertImage",A);this.im=this.findElm("IMG","src",A)}if(this.im){this.im.setAttributes({src:this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);
    Change it to this, replacing /images/uploads/ with the folder path from the root of your webserver that your images are stored in:

    var nicImageButton=nicEditorAdvancedButton.extend({addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.addForm({"":{type:"title",txt:"Add/Edit Image"},src:{type:"text",txt:"URL",value:"",style:{width:"150px"}},alt:{type:"text",txt:"Alt Text",style:{width:"100px"}},align:{type:"select",txt:"Align",options:{left:"Left",right:"Right"}}},this.im)},submit:function(B){var C=this.inputs.src.value;if(C==""){alert("You must enter a Image URL to insert");return false}this.removePane();if(!this.im){var A="javascript:nicImTemp();";this.ne.nicCommand("insertImage",A);this.im=this.findElm("IMG","src",A)}if(this.im){this.im.setAttributes({src:"/images/uploads/" + this.inputs.src.value,alt:this.inputs.alt.value,align:this.inputs.align.value})}}});nicEditors.registerPlugin(nicPlugin,nicImageOptions);
    •  
      CommentAuthorbakercad
    • CommentTimeMay 16th 2008
     
    damn you Christopher...you beat me to it! bakie
    •  
      CommentAuthorperthmetro
    • CommentTimeMay 17th 2008
     
    Thanks Chris - I had to put in the whole http://www.mysite/sub/sub for it to pick the image up, but it worked a treat.

    @Bob, curse those fast young kids!
    •  
      CommentAuthorperthmetro
    • CommentTimeMay 29th 2008 edited by perthmetro on the 14th June 2008 at 21:54:57 EDT
     
    I can insert an image no probs and align it to to left or right ok, BUT when I change the alignment to the other side it adds on the full image url to the url and the image can't be seen...

    eg. when i insert the image first and align it first time and then view the source it looks like this ...
    /images/uploads/example.jpg

    then when I give it another image alignment it disappears and the source looks like this...
    /images/uploads//images/uploads/example.jpg
    •  
      CommentAuthorperthmetro
    • CommentTimeJun 11th 2008
     
    Can anyone help me on this problem?