Relative VS Absolute url for images

Last post 05-06-2008, 10:39 AM by Adam. 3 replies.
Sort Posts: Previous Next
  •  03-28-2006, 10:52 AM 17656

    Relative VS Absolute url for images

    Hi,

    I have noticed that in the online demo (http://cutesoft.net/example/Relative-or-Absolute-URLs.aspx) when absolute url is selected, the format of the image's url becomes [folder name] / [image name]

    In my case, i always have the name of my virtual directory included in the url : [virtual directory name] / [folder name] / [image name] which is a problem if I need to publish my site under a different name later (under a different virtual directory) because that is the url saved for the image and the path would not exist anymore... That's why i would like to be able to eliminate from the image's url the [virtual directory name] part

    I have tried to change the "UseRelativeUrl" and "RemoveServerName" properties, but it still includes my virtual directory in the images'url...

    My ImageGalleryPath is set to "~/images" (in my "default.config" file)
    My image folder is right in my virtual directory (ie test\images)

    Could you help me find what I am doing wrong?
    Could you also tell me how the example at the adress I gave above is set up? (where is the image folder)

    Thanks!



  •  03-28-2006, 1:58 PM 17669 in reply to 17656

    Re: Relative VS Absolute url for images

    Please check the following article:
     
    Absolute and Relative Paths


    When you're creating links to documents and images on the Web, you need to think about how you're going to link to them.

    Cute Editor support three standard ways to create links:

    1. absolute paths without the domain name ( <a href="/default.aspx">Home</a> )
    2. absolute paths with the domain name ( <a href="http://cutesoft/default.aspx">Home</a> )
    3. relative paths ( <a href="default.aspx">Home</a> or <a href="#top">Top</a>)  

     

    To create links correctly in Cute Editor, you need to use the following two properties:


    Editor.RemoveServerNamesFromUrl Property
    :

    By default Internet Explorer converts all URLs in hyperlinks (anchor tags) and images (img tags) to absolute URLs with the hostname name. When this property is set to true (the default), CuteEditor strips out the local server name from all A and IMG tags if the hostname in the URL matches the current hostname.

    Editor.UseRelativeLinks Property:

    By default Internet Explorer converts all URLs in hyperlinks (anchor tags) absolute URLs. When this property is set to true, Cute Editor should strip the absolute link paths.


    Use absolute paths without the domain name.  


    To use absolute paths without the domain name, you need to set Editor.RemoveServerNamesFromUrl property to true (by default).

    Example:

    <CE:Editor id="Editor1" RemoveServerNamesFromUrl="true" runat="server"></CE:Editor>

     

    Use absolute paths with the domain name.   

     


    To use absolute paths with the domain name, you need to set Editor.RemoveServerNamesFromUrl property to false and Editor.UseRelativeLinks property to false .

    Example:

    <CE:Editor id="Editor1" RemoveServerNamesFromUrl="false" UseRelativeLinks="false" runat="server"></CE:Editor>

     

    Use relative paths  

     


    To relative paths, you need to set Editor.RemoveServerNamesFromUrl property to true and Editor.UseRelativeLinks property to true .

    Example:

    <CE:Editor id="Editor1" RemoveServerNamesFromUrl="true" UseRelativeLinks="true" runat="server"></CE:Editor>

     




      

      


    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

  •  05-06-2008, 7:40 AM 40091 in reply to 17669

    Re: Relative VS Absolute url for images

    In what document do I use this command?
    I am having troubles to make IE and firefox to use absolute paths.
     
    Tried it like this in my asp document:
     
    ---------------
    DIM editor
    editor.ID = "Editor1"
    editor.RemoveServerNamesFromUrl="true"
     ....
    ---------------
     
    But this makes no difference, so I guess I am making changes in the wrong document - is it somewhere in the cute editor files where I should make these changes?
  •  05-06-2008, 10:39 AM 40102 in reply to 40091

    Re: Relative VS Absolute url for images

    Jake,
     
    The RemoveServerNamesFromUrl is obsolete. Please use UTLType property.
     

    Editor.URLType Property

    Specify whether the URL should be converted to a site root relative path (/html/images/image1.gif) or an absolute path (http://www.mysite.com/images/image1.gif).

    URLType Enumeration

    Specify whether the URL should be converted to a site root relative path (/html/images/image1.gif) or an absolute path (http://www.mysite.com/images/image1.gif).

     
    Member Name Description
    Default The URL is not converted.
    SiteRelative The URL is converted into a site root relative path. A site root relative path describes the location of the destination file by describing the route the browser must take from the Web site's root folder (top level in the folder structure). For example, a site root-relative path to an image may appear as: /html/images/image1.gif
    Absolute The URL is converted into an absolute path. An absolute path describes the physical location of a file on a machine or the exact location of a file on the Internet. An absolute path on your hard drive might appear as: An absolute path might appear as: http://www.mysite.com/images/image1.gif

    Demo:

     

    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

View as RSS news feed in XML