Images wont show

My images wont show in ionic view.
This is the line of code i use:
<img src="assets/img/mypng.png"/>

@Limzee
[src] is a good practice in ionic.
make sure your assets folder is inside your src folder.

It’s not the ionic framework that’s wrong, it’s the way you’re using the img tag in HTML. The img tag has no closing slash so your code should be as follows:

<img src="assets/img/mypng.png">

nope that didnt do it :confused:

Yea its in src/assets/img

If after all what have been said your problem still not solve, then definitely you got the wrong path to the file. Would you mind to post here the expand directories from where your image is and the html file you want to use it in?

1 Like

well it does work in ionic serve

@Limzee I believe Ionic View might pull a weird move with a path that’s different than the way ionic serve handles them. You might want to try something like:

<img src="../assets/img/mypng.png">

or

<img src="../../assets/img/mypng.png">

I think the Images must lay under Folder

WWW/ASSETS.

Normally the CLI syncs the Folders but sometimes not.

As you are running this in the ionic view, you’d better try this one:
“img/mypng.png”

thank you! that wasnt the problem but when i checked that folder i found that the png had upper case letters

1 Like

like we said, there were something wrong in the path :smile:

1 Like