[Chameleon] mapDHTMLwidget occassionally fails

J. Delfos delfos18 at yahoo.com
Fri Aug 27 04:11:33 EDT 2004


Hi Bart,

It's not really a fix, more like a cover-up. I did it for the 1.0.4
version, but just now I managed to get a similar solution working for
1.99.

For 1.99, in mapDHTMLwidget.js, add the following code at the end:

--------------------------------------
var backupURL = "";
function imageErrorOccurred (mapurl)
   {
   //alert (mapurl);
   document.images["MapLayerDivImg"].src = 
document.images["mapimage"].src;
   backupURL = mapurl;
   setTimeout("reloadImage()",500);
   }

function reloadImage()
   {
   document.images['MapLayerDivImg'].src = backupURL;
   }
------------------------------------------

Then place the following attribute in your MapLayerDivImg definition:

onError=\"imageErrorOccurred(gMapDHTMLURL)\" 


What it does: when the image breaks, it immediately replaces the image
source with that of the empty white pixel (to prevent the user from seeing
a broken image), and after a small delay it loads the correct url into the
image. It works for me.

It's a slightly different implementation in version 1.0.4 (you'd have to
modify mapDHTMLimage.widget.php). I'm not sure which one you're after, so
I'll attach both files. Use the JS for 1.99, the php for 1.0.4. 

regards,

Jacob


P.S. Sorry voor de onmeundig lelijke PHP code. Geen idee wat of ik doe in
die taal. (Forgive me my ugly PHP coding. Have been too lazy to look for
good tutorial.)


		
__________________________________
Do you Yahoo!?
Yahoo! Mail Address AutoComplete - You start. We finish.
http://promotions.yahoo.com/new_mail 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patchedForBrokenImage.zip
Type: application/x-zip-compressed
Size: 16177 bytes
Desc: patchedForBrokenImage.zip
Url : http://lists.maptools.org/pipermail/chameleon/attachments/20040827/0b7b351a/patchedForBrokenImage-0001.bin


More information about the Chameleon mailing list