obout editor Absolute path for uploaded image

本文转自:https://www.obout.com/editor_new/KnowledgeBase.aspx?id=706

 

 

Absolute path for uploaded image

Q: 

I use the code of 'cs_Custom_ImageUpload_popup.aspx' file from the Suite for images uploading.
This code uploads images and inserts them into content.
Each new inserted image has relative path like here:
    <img src="/newsletterImages/View.jpg" ...  />
 
Is there an easy way to make an absolute path like here?
    <img src="http://www.domainname.co.za/newsletterImages/View.jpg" ... />

A: 

Open for editing the ASPX file that contains the JavaScript code for images uploading (like in  'cs_Custom_ImageUpload_popup.aspx').

Find the following lines:

else  // Cancel clicked or emulated 
{
   if(imageFileName != null) 
   {
      editor.focusEditor();
      editor.InsertHTML("<img src=\""+imageFileName+"\" alt=\""+imageFileTitle+"\" title=\""+imageFileTitle+"\" />"); 
   }
}

Edit them:

else  // Cancel clicked or emulated 
{
   if(imageFileName != null) 
   {
      editor.focusEditor();
      var img = new Image(); 
      img.src = imageFileName;
      editor.InsertHTML("<img src=\""+img.src+"\" alt=\""+imageFileTitle+"\" title=\""+imageFileTitle+"\" />"); 
   }
}

Save the file.

 

你可能感兴趣的:(absolute)