Forums

PHP echo images in post (5 posts)

  1. MeltingDog
    Member
    Posted 6 months ago #

    Hi guys,

    Bit of a weird one - I have a php loop that spits out an image path from a database. I know I have to use bloginfo("template_directory") to display the image but I'm not sure how to exactly using my echo function. I need to some how combine that template directory php and the $row php...

    The code I have is:

    echo '<img src="' . bloginfo("template_directory") . $row['itemimage'] . '"/>';

    But it of course displays that directory as a string. Any other way I configure it just creates an error.

    Can anyone help me out at all? Thanks!

  2. MeltingDog
    Member
    Posted 6 months ago #

    I should mention that I am using a plugin that allows me to include PHP in the my posts/pages. I have tested it and it works fine - just this issue with the images...

  3. MeltingDog
    Member
    Posted 6 months ago #

    Anyone?

  4. MeltingDog
    Member
    Posted 5 months ago #

    Yeah - I figured it out on another forum. It was to do with WP being installed on htdocs/xampp rather than just in the htdocs directory. Also file permissions where blocking Apache.

  5. MeltingDog
    Member
    Posted 5 months ago #

    PS: the bloginfo("template_directory") in the image path was unnecessary as well

Reply

You must log in to post.

About this Topic