[Chameleon] mapDHTMLwidget occassionally fails

Jacob Delfos jacob.delfos at maunsell.com
Sun Aug 29 21:27:25 EDT 2004


Bart,

I actually noticed this problem happening with other images as well (e.g. buttons, legend images, etc, after a submit). They just show up as broken images. And that was on a dial-up connection. I don't think it's anything wrong with the chameleon code, but rather something with how apache interacts with PHP. Chameleon probably pushes that to its limits. The fact that it is so hard to reproduce when you want it to happen makes it annoying to debug. What hardware do you run? I have it happening on a P4 2.8GHz, win2k, Apache 2.0.48.
By the way, the file I sent you (MapDHTMLWidget.widget.php.forCWC1.0.4) has an extra <<<EOT on line 998, which must be removed.

I think the best fix would be if every image in chameleon (legend, button, mapimage, etc.) had an 'onError' attribute, which would invoke a function that reloads that image after a delay. I have tried to find out whether there is a function to check whether an image loaded successfully (e.g. by checking filesize), but I couldn't find one.

BTW Bart, I am Dutch. Moved to Australia 4.5 years ago.

regards,

Jacob




-----Original Message-----
From: chameleon-bounces at lists.maptools.org [mailto:chameleon-bounces at lists.maptools.org] On Behalf Of bartvde at xs4all.nl
Sent: 27 August 2004 16:38
To: chameleon at lists.maptools.org
Subject: RE: [Chameleon] mapDHTMLwidget occassionally fails


Hi Jacob,

thanks. I'll give your fix a try.

Paul, since more people are experiencing these problems, has the cause of
this problem been identified and will it be fixed in the next Chameleon?
Will this change the way the Chameleon map load now works?

BTW Jacob: did you write the Dutch with an automatic translator, or you
actually speak it?

Best regards,
Bart

>
> 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 wa'k doe in die
> taal. (Forgive me my ugly PHP coding. Have been too lazy to look for good
> tutorial.)
>
>
>
>
>
>
>
>
>
>
>
>
>

_______________________________________________
Chameleon mailing list
Chameleon at lists.maptools.org
http://lists.maptools.org/mailman/listinfo/chameleon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/chameleon/attachments/20040830/73eec166/attachment.htm


More information about the Chameleon mailing list