We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How do i add an image to my HTML - code.

How Do I?

vanoevelenstef's avatar
vanoevelenstef
4 posts
5 years ago
vanoevelenstef's avatar vanoevelenstef

Hey! I’m quite new to ExpressionEngine and my teacher showed me how to use it but now I can’t get my image to show up on my website, so it’s clearly the {exp:} that’s wrong.

Can anybody give me the right way to code this?

It would be a huge help!

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
5 years ago
Robin Sowell's avatar Robin Sowell

Hi and welcome aboard!

Did you use a file field to hold your image when you created the entry? And does it show. up in the control panel when you edit the entry?

What’s your channel entry tag look like on the template that should be displaying the image?

       
vanoevelenstef's avatar
vanoevelenstef
4 posts
5 years ago
vanoevelenstef's avatar vanoevelenstef

Hey Robin

I used a file field to upload my image and created the entry. It does show up, so I think that part is correctly done.

This is the channel entry tag i used in my template:

{exp:channel:entries channel="portfolio" limit="1" paginate="bottom"}
{portfolio:img_shape_001.jpg:}
{/exp:channel:entries}
       
Robin Sowell's avatar
Robin Sowell
13,158 posts
5 years ago
Robin Sowell's avatar Robin Sowell

Got it- so the short name of the file field is portfolio- right?

You could either use a single variable to show the url a la:

{portfolio}

Or you could use a variable pair:

{portfolio}
 This file is a {extension} and was uploaded on {upload_date format="%Y %m %d"}
  <a href="http://{url}">View it now</a>
{/portfolio}

Checked the linked docs, they’ll give you more options for what you can show.

This get it working?

       
vanoevelenstef's avatar
vanoevelenstef
4 posts
5 years ago
vanoevelenstef's avatar vanoevelenstef

Thanks for the quick response.

It still doesn’t work, so either I’m doing stupidly wrong or i just don’t get it.

I tried adding the image with the code u sent and it only shows up as text on my web page.

Below I added my whole HTML code (without stylesheet ofc. And in the embed is my stylesheet.) so maybe you can spot what I’m doing wrong:

{embed="embeds/_head"}

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
  <meta charset="utf-8">
  <title>STEF VAN OEVELEN</title>
  <link rel="stylesheet" href="Stylesheet_split.css">
</head>
<body>

  <div class="split left pagelayout">
    <div>
      <span class="text sticky">Dark Galleries, Publication; 000 x 000 mm, 20XX.</span>
      images/DARKGALERIES/img_1.jpg
      {trustme_img_008}
      images/DARKGALERIES/img_2.jpg
      images/DARKGALERIES/img_3.jpg
      images/DARKGALERIES/img_4.jpg
      <span></span>
    </div>
    <div>
      <span class="text sticky">Republishing, Publication; 000 x 000 mm, 20XX.</span>
      images/REPUB/repb_img_1.jpg
      images/REPUB/repb_img_2.jpg
      images/REPUB/repb_img_3.jpg
      images/REPUB/repb_img_5.jpg
    </div>
  </div>

  <div class="split right pagelayout">
    <div>
      <span class="text sticky">Republishing, Publication; 000 x 000 mm, 20XX.</span>
      images/REPUB/repb_img_1.jpg
      images/REPUB/repb_img_2.jpg
      images/REPUB/repb_img_3.jpg
      images/REPUB/repb_img_5.jpg
        </div>
    <div>
      <span class="text sticky">Dark Galleries, Publication; 000 x 000 mm, 20XX.</span>
      images/DARKGALERIES/img_1.jpg
      images/DARKGALERIES/img_2.jpg
      images/DARKGALERIES/img_3.jpg
      images/DARKGALERIES/img_4.jpg
    </div>
  </div>

</body>
</html>
       
Robin Sowell's avatar
Robin Sowell
13,158 posts
5 years ago
Robin Sowell's avatar Robin Sowell

The file field is for use in either the channel entries module or the file module.

So if you have an entry and you want to show the data in the entry, including that image that’s in a file field in the entry, you’d use a channel entry tag and then the file field variable(s).

In the above, you don’t have a entry tag or a file tag.

Are you wanting {trustme_img_008} to be parsed? And as what? Where does trustme_img_008 come from? Is it a field name?

       
vanoevelenstef's avatar
vanoevelenstef
4 posts
5 years ago
vanoevelenstef's avatar vanoevelenstef

{trustme_img_008} is an image file name from my database (uploaded via channel(that is called: portfolio). And I uploaded them via the ‘images’ in the entry.

I don’t know of there is anything more that you need to know … I’m just really struggling with this and i don’t know what to anymore and I’m losing my mind over this

       
Robin Sowell's avatar
Robin Sowell
13,158 posts
5 years ago
Robin Sowell's avatar Robin Sowell

EEEE- I’m sorry. It’s hard to know without seeing it.

Is the image in an entry? So- like in the attached image, the ‘b_img’ field?

If so- what’s the entry id- you can tell by looking at the url when you go to edit the image.

And the image field name is {trustme_img_008}- right?

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.