+ 1

Do I need to connect my PC to the internet for an image tag <img> to display the picture on a chrome browser?

<body> <img src="preco.jpg" width="100" height="100"> </body> Please note : The picture file is in the same folder with the .html file.

18th Apr 2019, 9:27 PM
Oweh Pascal
Oweh Pascal - avatar
12 Respostas
+ 1
NWUCHOLA OWEH PASCAL open the console in Chrome and post here the error that is showed. To open the dedicated Console panel, either: Press Ctrl+Shift+J (Windows / Linux) or Cmd+Opt+J (Mac).
18th Apr 2019, 10:03 PM
Pietro Campiotti
Pietro Campiotti - avatar
+ 1
No, if your project is on the local PC you dont need to connect to internet
18th Apr 2019, 9:55 PM
Pietro Campiotti
Pietro Campiotti - avatar
0
@ Pietro thanks for your prompt response. I'm still getting a thumbnail as the image after running the code
18th Apr 2019, 9:58 PM
Oweh Pascal
Oweh Pascal - avatar
0
Failed to load resource: net: : ERR_FILE_NOT_FOUND. precohh.jpg:1
18th Apr 2019, 10:10 PM
Oweh Pascal
Oweh Pascal - avatar
0
Is precohh.jpg the correct name of the image?
18th Apr 2019, 10:11 PM
Pietro Campiotti
Pietro Campiotti - avatar
0
Yes it is, and I've copied the image file to the same folder where the .html file is located
18th Apr 2019, 10:13 PM
Oweh Pascal
Oweh Pascal - avatar
0
Ok try changing the src from src="file_name.jpg" to src="./file_name.jpg"
18th Apr 2019, 10:14 PM
Pietro Campiotti
Pietro Campiotti - avatar
0
Thanks a lot Pietro. I just figured out the error
18th Apr 2019, 10:20 PM
Oweh Pascal
Oweh Pascal - avatar
0
Which was?
18th Apr 2019, 10:21 PM
Pietro Campiotti
Pietro Campiotti - avatar
0
The preco image file is actually not a jpg file. It has windows player icon on it. so I tried another image that's in jpg format, and it worked.
18th Apr 2019, 10:23 PM
Oweh Pascal
Oweh Pascal - avatar
0
Ok so the problem was the file name. Anyway use the console to debug your code when something doesn't work. Byee
18th Apr 2019, 10:25 PM
Pietro Campiotti
Pietro Campiotti - avatar
0
Yeah! Sure I'll. Thanks once again
18th Apr 2019, 10:26 PM
Oweh Pascal
Oweh Pascal - avatar