Q:

PHP/HTML image not being sourced when running XAMPP Server

When using XAMPP, I am loading a page (index.php) and am using MySQL to get the directory of an image I want to use. This is a snippet of the code block that does this:
<img src="<?php echo $resource['main_image'];?>">

I know that the php code is working because when I inspect element the page on localhost, I get
<img src="assets/images/defaults/default_pic.png">

This image exists in the folder but just doesn't seem to load when the server is run. When I inspect element and click on Sources, the image folder is not sourced, but the css and js folders are:

As you can see, the assets/images folder is not loaded. I can't seem to find any way to load this folder. I have tried other solutions to similar problems, such as giving an absolute path to the image, and yet other folders a sourced and not this image folder. I have tried looking for ways to source images in the head of the HTML, and those don't exist either.
In addition, it seems that if I explicitly state the image location and not use a MySQL Query to locate it, it loads fine. It is only when I query the location does the image not load.

A:

A workaround that worked for me is to create a new directory for pictures outside of assets, in the working directory of the current file. It is not ideal, but it is a workaround for the issue.

