Adding a picture in my application

Hello! I’m very new in Ionic 2 (and mobile application in general). I would like to add a background image and a picture in my window. So, I wrote this in my html file:

 <img src="swop.png'" alt="swop">

And in my scss file, I have:

.getstart {
//background-color: red; // this command works
background-image: url(‘background.png’);
background-repeat: no-repeat;
background-size:cover;
}

As you can see, I want to put the picture background.png in background and the picture swop.png in the window.
I really don’t understand why it doesn’t work. I know that my .scss file is read because I tried to put a red background and it worked. Maybe I have to declare or import the pictures somewhere else, like in variables.scss? Or the syntax has changed? Here are the errors I got, maybe it can help:
image

As you can see, there are two errors. The first one says that it can’t find the picture swop, while the picture is in the same folder than the html file and the second one talks me about the folder build… Why? Is there someone who could help me?

Hello!

move your images/fonts etc to assets folder.
D:/yourproject/src/assets/img/swop.png

and change you img tag to
<img src="assets/img/swop.png'" alt="swop">

Hope it helps

1 Like

Hello ekhmoi! Thanks for you quick answer :slight_smile:

It works perfectly. Well, I had some troubles at the beginning but it was because of a stupid apostrophe which had been accidently added in the path and maked the application failed…

Thanks again :slight_smile: