Web space requires url’s. Url’s to a webserver are all relative to the “web root” as defined by your web server configuration.
When you open a local file, you are working with your workstation file system, and the rules of the operating system. The 2 systems are incompatible.
A url:
https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png
This resource is returned to you by the webserver, but you really have no idea where it actually resides within the google infrastructure. It could be an image that was generated on the fly, by some software, and not a physical image located on any server or storage system.
C:\wamp64\www\ecom\images\somefile.jpg is a path to a file on a windows computer. That is not “web space”.
Within web space, you typically define the path to resources like static images relative to the webroot. So your markup would be something like:
<img src="/images/<?= $productImg ?>" alt="picture of product">
This is just a made up example on my part that shows one way markup might be using a php variable and appending it a string using php’s ability to intermix php and html.
Assume that $productImg = “newproduct.jpg” here.
It should be apparent that the effective url to the image in web space is “/images/newproduct.jpg”.
If you aren’t clear on how you have configured your localhost web server, make a php script that has nothing in it other than:
phpinfo();
The configured directory that is the web root for your server will be listed as the DOCUMENT_ROOT.
Any thing that is in a folder beneath the DOCUMENT_ROOT directory will by default be available in webspace, however, when referencing anything like images, css or javascript, you will reference those things relative to the web root ie. “/css/styles.css” or “/images/products/acmewidget.png”.
Anything in your html requires url’s, not file system paths.
Hopefully it is clear in this example that if the webroot is:
C:\wamp64\www\ecom\
And your html needs to reference the file on your filesystem that is:
C:\wamp64\www\ecom\images\somefile.jpg
Then the relative path to that would be:
/images/somefile.jpg
Notice also that in webspace you use forward slashes and not backslashes! Don’t use windows backslashes for anything inside your html, css or javascript.
You probably already know what the webroot is, because it’s the same directory where you have the index.php or whatever other script is that you ran to display the broken images.
Fix the img src’s to use relative paths to your webroot. My guess is that your webroot is pointing to C:\wamp64\www\ecom, but again you can verify that and fix your url’s accordingly.