• Resolved jeroslav

    (@jeroslav)


    Hello!

    I’ve got a problem and it’s that it wont show the image.

    I used this code:

    <img src="<?php echo bloginfo('get_template') . '/img/sample/family.jpg'; ?>" alt="smiling girl" class="thumb"/>

    Please help!

Viewing 13 replies - 16 through 28 (of 28 total)
  • Thread Starter jeroslav

    (@jeroslav)

    You mean using
    <img src="img/sample/family.jpg" alt="smiling girl" class="thumb"/>

    instead of

    <img src="/wp-content/themes/<?php echo bloginfo('get_template') . '/img/sample/family.jpg'; ?>" alt="smiling girl" class="thumb"/>

    It still doesnt show the picture. But when i designed the website without wordpress implementation it worked ok.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Yes, sorry I meant that but I got the URL wrong. Try this instead;

    <img src="img/logo.png" alt="smiling girl" class="thumb"/>

    Thread Starter jeroslav

    (@jeroslav)

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Is that due to CSS applying to the “thumb” class?

    Thread Starter jeroslav

    (@jeroslav)

    Hmm no, even without the thumb class it is the same size.. Smaller than before.

    and the thumb class is for that family picture.

    .post-item img.thumb {

    float:left;
    padding-right:20px;
    padding-left:20px;
    padding-top:20px;

    }

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Have you concluded the image is now loading?

    Thread Starter jeroslav

    (@jeroslav)

    What do you mean by that?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Do you still get this error;

    Object not found!

    The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.

    If you think this is a server error, please contact the webmaster.

    Error 404

    Thread Starter jeroslav

    (@jeroslav)

    Yep I still get it.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Sorry, I cannot hypothesize anymore.

    Thread Starter jeroslav

    (@jeroslav)

    Hmmm, when i use

    <img src="<?php echo bloginfo('get_template') . '/img/sample/family.jpg'; ?>" alt="smiling girl" class="thumb"/>

    its the URL

    <img src="ZPMpravna/img/sample/family.jpg" alt="smiling girl" class="thumb"/>

    but the index.php file is located in ZPMpravna so isnt that the URL should be “/img/sample/family.jpg” without the ZPMpravna?

    Thread Starter jeroslav

    (@jeroslav)

    Ok now it works!

    with this:

    <img src="<?php echo bloginfo('template_directory') . '/img/sample/family.jpg'; ?>" alt="smiling girl" class="thumb"/>

    its template_directory instead of get_template šŸ˜€

    anyway thanks for your time Andrew! šŸ™‚

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    And thanks for sharing the answer to the community šŸ™‚

Viewing 13 replies - 16 through 28 (of 28 total)

The topic ‘Problems with implementing img src withwordpress’ is closed to new replies.