Thanks PeejAvery for the response.

The reason I posted it in PHP is because all the JS was working fine until I moved it to the localhost root (/var/www/).

Also, I had the image as "map.jpg" as noted in the comment. I was merely trying "/var/www/map.jpg" to see if that was a problem (but you're absolutly right, that makes 0 sense to a client which has no idea they are in my "/var/www" folder).

I actually figured out the problem with a little bit of messing around and reading.

"map.jpg" permissions were set as:
-rw------- (observed using "ls -l" in terminal)
This means that only I can read and write to the image file, no one in my group or on the computer can do anything but me (excluding root of course).

I modified the permissions on the file to:
-rw-rw-r--
using "chmod g+rw map.jpg"
and "chmod a+r map.jpg"
which lets my group read and write and everyone (all) read, respectively.

That solved the problem. Before when I tried to view "localhost/map.jpg" I got a "403 access denied" error. Now I can see the image fine as a client. This was infact not a JS or a PHP problem, but merely a unix file-permission problem.

Thanks for the response again PeejAvery. I'm learning something new about computers every day