• I am currently still on a local installation and have not been able to link to an image directly using <img src=””> inside a page.

    To keep true photo images and site design stuff separate, I created a folder /res (short for resources) in the root of the theme (thus on the same level as /images)

    I can link to these files in /res fine through CSS.

    On a few pages I wish to insert an accent icon or bullet from /res into the text and can’t seem to get the path right … or end up with php code not executing.

    a) manual method, relative path, no image shown

    <img src="/res/gif/bullet_info_sq.gif" alt="" />
    and
    <img src="res/gif/bullet_info_sq.gif" alt="" />

    b) php method, no image shown

    <img src="<?php bloginfo('url');?>/images/audio.jpg">
    ends up as
    <img src="<?php bloginfo('url');?>/images/audio.jpg”>
    in the output html.
    
    that last part being: /audio.jpg & # 8 2 2 1 ; >
    without spaces.

    How can I make sure the php bloginfo works properly?

    Could this not functioning be related other php code in page.php.
    I do have an if else routine to eliminate the sidebar on some pages and to switch class=narrowcolumn to class=onecolumn.

    WordPress 2.7. Kubrick. CSS modified.

    Highly appreciate your help and insight.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    PHP won’t work in your posts without a plugin, IIRC.

    As for example a… What’s the absolute path to your image? https://fobar.com/res/gif/bullet_info_sq.gif? If so, that first example should work. If not, try putting in the full path in your image link.

    Thread Starter icerabbit

    (@icerabbit)

    thanks lpstenu,

    Right now I am still on the local machine via https://localhost:8888/wordpress/

    Using that, I am (finally) getting a result via:

    <img src="https://localhost:8888/wordpress/wp-content/themes/default mod to wphm/images/audio.jpg" alt="" />

    While I understand that absolute paths are ideal; I am still hoping to “automate” that home path, so I would not have to redo everything when the site goes live.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php code or image path to use <img src=””> directly inside a post’ is closed to new replies.