• Resolved WPrap

    (@wprap)


    Have installed xampp/wordpress – things working except when try to display an image (jpg).

    As a test, created a page and put the following code in it:

    <img scr=”fc101.org/wp-content/themes/twentythirteen/images/gene-150×150.jpg” alt=”Gene” />

    ‘WP’ couldn’t resolve the image ‘URL’ so only got Gene displayed.

    What am I doing wrong?

Viewing 11 replies - 1 through 11 (of 11 total)
  • You need to indicate that the file location is a web address by adding a prefix “http://&#8221; to the scr line. As it is the browser is looking for a folder in a directory called “fc101.org”
    On a technicality it was not WP which couldn’t resolve the image but your browser, this is an important distinction.

    Thread Starter WPrap

    (@wprap)

    Thanks RossMitchell for the suggestion, however tried

    <img scr="http://fc101.org/wp-content/themes/twentythirteen/images/gene-150x150.jpg" alt="Gene" />

    but no joy

    had also tried
    <a href="http://fc101.org/wp-content/themes/twentythirteen/images/gene-150x150.jpg">page</a> before – sorry for not mentioning it.

    In the Sample page there is code
    <a href="http:/wordpress/wp-admin/">your dashboard</a> that works so don’t understand my failure (though don’t know about the http:/ – copied the code so it’s not a typo).

    What is your browser inspector telling you ? You must use one in these situations. I use firebug, there is an equivalent addon for each browser.

    The example you give that is working has a syntax error, if it is working it might be fro the wrong reason, to be correct it would have to be either:

    <a href="http://wordpress/wp-admin/">your dashboard</a>

    OR

    <a href="/wordpress/wp-admin/">your dashboard</a>

    Which one of these work ? Your browser is choosing one of these interpretations, which one ? The problem is that other browsers may make the other choice, so you have to sort this out.

    Thread Starter WPrap

    (@wprap)

    Working backwards in your response the

    href=”/

    works.
    I’m using FX with fireBug … which I am not experienced using (just to check which elements need to be changed in a custom style.css). Is there an article or write-up describing how to go about finding the cause of this problem?

    Thank you very much for any help you can provide.

    If youre working with localhost its more than likely that fc101.org is not pointing to your machine but some other machien on the web. And that it looks for the image on some other server than yuors and therefore gets 404.

    Easiest would just be using <img src=”/wp-content/uploads/whateverimage.jpg”>

    I just did a whois and can see that fc101.org isnt even registered. So it may be a local “domain”. So I suggest setting

    127.0.0.1 fc101.org

    in your C:\windows\system32\drivers\etc\hosts (or is it hosts.txt i dont rememeber). It requires adminpermissions to edit so go to your “start menu TM” and shift+rightclick notepad and select “run as administrator” and then open the file.

    Edit:
    One other possibility is that you just registered fc101.org and in that case not all NS/DNS servers had time to update its records and therefore is the reason it doesnt show up, in that case dont add it to hosts.

    Thread Starter WPrap

    (@wprap)

    rollingWolf – thanks for the sugg … unfortunately the ‘abbreviated’ img didn’t fix the prob.

    FC101 – confession … doesn’t show up in whois because it’s only a short form of firechaplain101.org … used only in this forum because I didn’t want to type out the whole name – the true website name is used on the localhost pages..

    Your comment

    …its more than likely that fc101.org is not pointing to your machine…

    is probably right on. firechaplain101.org is an actual website (WP designed – that I inherited)and I’ve since ‘built’ an XAMPP ‘system’ on my PC for the next iteration of firechaplain101.org. Would clearing my FX cache get rid of ‘wrong pointers’? {Just tried, DIDN’T}

    The header image is ‘in’ the folder uploads/2015/04 and is displayed correctly but is ‘pointed’ by:
    http://127.0.0.1/wordpress/wp-content/uploads/2015/04/FC101header11.png … tried it and WORKED

    Thread Starter WPrap

    (@wprap)

    Update:
    I think my prob is resolved. Thank you both (Ross and rolling)

    Thread Starter WPrap

    (@wprap)

    oops – spoke too soon. I have an
    <a href="http://127.0.0.1/wordpress/wp-content/uploads/2015/04/gene-150x150.jpg">page</a> and an
    <img scr="http://127.0.0.1/wordpress/wp-content/uploads/2015/04/gene-150x150.jpg" alt="Gene" >
    both on the Home page.

    The <a.../a> works but not the img. Weird

    Youve typed “scr” . . It supposed to be “src”

    Thread Starter WPrap

    (@wprap)

    totally embarrassed (my only excuse – & not much of one – is
    forest & trees)

    Thanks – and truly RESOLVED

    Your solution using 127.0.0.1 will only work while you are viewing the website from the machine hosting your site.
    You need to replace the 127.0.0.1 with a domain name. The domain name is then resolved to your server (or gateway) using either the DNS system, or adding entries to your hosts file.
    Details on hosts file for various operating systems here:
    http://en.wikipedia.org/wiki/Hosts_%28file%29

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘localhost – xampp install: trouble displaying images’ is closed to new replies.