0

After deploy my react project to github pages, i've got some error. all the images not displaying. i've been try some solution like change the path from '../' to './' nothing happen, then i change to '/', it also doesnt show the images. Then i try to moved all the images to public folder. still nothing happen

this is the solution that i've tried

<img src="src/assets/img/ramen.jpg" />
<img src="./src/assets/img/ramen.jpg" />
<img src="./public/assets/img/ramen.jpg" />
<img src="/public/assets/img/ramen.jpg" />
<img src="public/assets/img/ramen.jpg" />
<img src="assets/img/ramen.jpg" />

this is my repository https://github.com/callmecua1/Kitsune

2 Answers 2

0

If files in this root

public/images/ Use this root

'/images/imagename.jpg'

But if folder inside src(/src/images) And keep your image in it Use this root

'./images/image-name.jpg'
Sign up to request clarification or add additional context in comments.

Comments

-1

First Method:

Move ur image directory in src/assets directory the indicate the URL.

Second method:

-Import images as a variable

Import myImg from 'Your-Image-URL'

-Then use this variable

<img src={myImg} ..>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.