Insert Image but not from a directory or a website.

Last post 01-20-2009, 11:18 AM by Mvu. 2 replies.
Sort Posts: Previous Next
  •  01-20-2009, 6:44 AM 47890

    Insert Image but not from a directory or a website.

    I have implemented CuteEDitor ASP on my portal. My customers upload their images not in a directory but in a Access DB as binary file.

    In the toolbar of CuteEditor, I have Disabled the Itemlist like ImageGallery, InsertFlash ... and all that stuff. I have customized the toolbar and added one custom button with this code:

    <%...
    editor.CustomAddons = "<img title=""Using oncommand"" class=""CuteEditorButton"" onmouseover=""CuteEditor_ButtonCommandOver(this)"" onmouseout=""CuteEditor_ButtonCommandOut(this)"" onmousedown=""CuteEditor_ButtonCommandDown(this)"" onmouseup=""CuteEditor_ButtonCommandUp(this)"" ondragstart=""CuteEditor_CancelEvent()"" Command=""MyCmd"" src=""
    http://localhost/Carpenters/CarpentersAlbumPicturesLogo.asp?idCarp=2530"" width=""20"" height=""20""  />"
    %>
     
       <script type="text/javascript">  
          var editor1=document.getElementById("<%= editor.ClientID %>");
       function CuteEditor_OnCommand(editor,command,ui,value)
          {
              //handle the command by yourself
              if(command=="MyCmd")
             {          
        
              editor.ExecCommand("InsertImage");
              return true;
           }
            }
            </script> 
     

    Normally, to let display the image, it calls a script with this command: <img src="http://localhost/Carpenters/CarpentersAlbumPicturesLogo.asp?idCarp=2530">.

     

    My problem is that if I use the command InsertImage, I get the default interface(or browser)  of CuteEditor and of course I would not like to have it. I would just like to have CuteEditor write the following HTML code: <img src="http://localhost/Carpenters/CarpentersAlbumPicturesLogo.asp?idCarp=2530">.

    How could I do this while keeping the possibility to the layout functions (width, height, border color…) ?

  •  01-20-2009, 9:46 AM 47897 in reply to 47890

    Re: Insert Image but not from a directory or a website.

    Please use this method:
     
    PasteHTML()

    This method is used for pasting the specified HTML into a range within an editor document. If anything is selected, the selection is replaced with the new HTML and text.

    Example:

    // get the cute editor instance
    var editor1 = document.getElementById('CE_Editor1_ID');

    // pasting the specified HTML into a range within a editor document
    editor1.PasteHTML("Hello World");

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

  •  01-20-2009, 11:18 AM 47903 in reply to 47897

    Re: Insert Image but not from a directory or a website.

    OK,fantastic. Just one thing. If I write it in hard code like this it works fine:
    editor1.PasteHTML("<img src='http://www.wood-it.be/Carpenters/CarpentersAlbumPicturesLogo.asp?idCarp=2530'>");
     
    but the value of idCarp= is dynamic and if I write it this way, it does not work:
    editor1.PasteHTML("<img src='http://www.wood-it.be/Carpenters/CarpentersAlbumPicturesLogo.asp?idCarp="&pidCarp&"'>");
    and it is normal.
    How could I bypass this ?
View as RSS news feed in XML