Trouble displaying the map on the web

Jun 2, 2011 at 7:51 PM

The map generator worked great for me and I was able to view the map just fine on my local machine. I wanted to post the map online for the friends I play Terraria with, but I can't seem to get the map.html to find the map images. No matter what I've tried, I just get a fully black map.

I've tried modifying the basePath in the map.html file multiple times, using absolute and relative paths, double-checked the permissions, and everything I can think of, but nothing I've tried works.

The map file can be found at http://ghosr.com/terraria/map1.html, and the PNGs are in the folder http://ghosr.com/terraria/map1/

Any thoughts on what I might be doing wrong?

Jun 2, 2011 at 8:08 PM

You're trying to load the images through file:/// instead of http://

 

Change this: div.style.background = "black url(file:///"

to: div.style.background = "black url("

Coordinator
Jun 2, 2011 at 8:14 PM
Edited Jun 2, 2011 at 8:17 PM

I see the problem you're having.

The base path should be set to http://ghosr.com/terraria/map1/

If you scroll down in the map.html file you should find a line that reads:

div.style.background = "black url(file:///" + basePath + "Zoom%20" + zoomLevel.toString() + "/Layer%200/" + coord.x.toString() + "/" + coord.y.toString() + ".png)";

change this line to the following:

div.style.background = "black url(" + basePath + "Zoom%20" + zoomLevel.toString() + "/Layer%200/" + coord.x.toString() + "/" + coord.y.toString() + ".png)";

 

and that should fix it.

Jun 2, 2011 at 9:02 PM

Whoa, thanks for the quick reply!

Made the changes, but now nothing loads on the page at all. Just a white screen. The page source does appear to be there, but it fails to display anything. Perhaps just running out of memory on a cheap shared hosting account? Or do you think it might be something else?

Coordinator
Jun 2, 2011 at 9:27 PM

You got my post before I editted it to fix a typo. You need to change the second change to what I updated in the post.

Edit the second line again to

div.style.background = "black url(" + basePath + "Zoom%20" + zoomLevel.toString() + "/Layer%200/" + coord.x.toString() + "/" + coord.y.toString() + ".png)";

I highlight where the problem is.

Jun 2, 2011 at 10:08 PM

Works beautifully!

A winner is you!

Coordinator
Jun 2, 2011 at 10:22 PM

Good to hear.

You might want to grab a new version also. Backgrounds are working.