Display Image in Ionic App


#1

Trying to add an image to an html page in an ionic app. in the html page

add the image to app directory scr/assets/img/Test.jpg.

use img scr=“assets/imgs/Test.jpg”

using CLI to build the app. Image is not loading , tried with png image as well. Please advise what could be wrong


#2

i think you made it a spelling mistake in src tag
use <img src=“assets/img/Test.jpg”>


#3

Hi,
What I see from your question is that you add an image to the IMG folder from assets, but you are trying to add an image source inside your HTML file from the IMGS folder from assets.
Maybe this is the issue :slight_smile:


#4

Place your Image in “assets/img/yourimage.jpg” in your project and then you can show it like this:

<img src=“../assets/img/yourimage.jpg”>

and if this doesnt work try it like this:

<img src=“assets/img/yourimage.jpg”>

and if that doesnt work too try this:

<img src=“../../assets/img/Test.jpg”>

Notice: it depends in which folder or subfolder your html file is. For every subfolder you have to use one “…/”