• I am starting to really like wordpress. It is quite easy to use but I still get hiccups every once in a while.

    When I make a post I may have images I want to use. I store these images in:

    http://www.mydomain.com/images

    when I would make a post I would use the following code to insert an image.

    <img src="images/image.jpg"/>

    but… the image would not show or give that paper icon with an “x” to show that the file could not be found.

    So to get it to work I would have to use this:

    <img src="http://www.mydomain.com/images/image.jpg"/>

    I prefer not to code this way, but I am not sure how to make this work.. .Any ideas? is this because I should be using the “images” directory within my theme folder?

    Thanks for any help.

Viewing 2 replies - 16 through 17 (of 17 total)
  • l r

    (@lainyrache)

    It’s understood that..
    relative link = /images/image name and
    absolute = http://URL/images/image name

    But with wordpress why is there no ‘dynamic root url’ option.
    In other cms systems (eg drupal and cmsmadesimple) you can choose to add relative or absolute links within the wysiwyg editor.
    This difference is when you choose relative links.. a root url is set in config just once.
    The base href was called to the front end via eg base=true or $base_url.

    The root url is set in one place only… and is easy to change.

    If you choose relative settings then the page content editor never hardcodes the full url path into content pages.

    So content looks like this in the editor pages /images/imagename.

    However

    When you view source on the front end – the root url – declared just once in the config is used as a base and is passed to each path. This is dynamic and it is not hardcoded in individual pages. It is called from one root setting in config.

    So you have http://www.mydomain.com/images/imagename
    or http://www.mydomain2.com /images/imagename
    on front end source
    and
    /images/imagename.
    in the page editor source.

    So when you want to change your root – you only change it once.
    In the config file.
    Other systems do deal with the root url change via scripting.

    l r

    (@lainyrache)

Viewing 2 replies - 16 through 17 (of 17 total)
  • The topic ‘Using relative instead of absolute links for images?’ is closed to new replies.