[mapguide-users] Watermarks and licence agreements [No Viruses detected]

Paul Spencer pspencer at dmsolutions.ca
Thu Sep 7 13:00:22 EDT 2006


The simplest way to get 24 bit pngs with alpha transparency to work  
in IE (that I've found, and use daily) is to do the following:

in a CSS file or <style> tag, add the following class:

img.png24 {
/* img elements with a class of png24 will have the png24 filter hack  
applied
* in IE browsers only.  To make this work, images MUST have a width  
and height
* specified.  The minimum tag required is:
* <img class="png24" src="<url>" width="xx" height="xx">
*/
   filter:expression(applyPNGFilter(this))
}

in a JS file or <script> tag, add the following function:

/**
*  applyPNGFilter(o)
*
*  Applies the PNG Filter Hack for IE browsers when showing 24bit PNGs
*
*  var o = object (this png element in the page)
*
* The filter is applied using a nifty feature of IE that allows  
javascript to
* be executed as part of a CSS style rule - this ensures that the  
hack only
* gets applied on IE browsers
*/
function applyPNGFilter(o)  {
    var t="images/a_pixel.png";
    if( o.src != t ) {
        var s=o.src;
        o.src = t;
        o.runtimeStyle.filter =  
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+s 
+"',sizingMethod='scale')";
    }
};

In your HTML, when you want to display a 24bit png, you can do so using:

<img class="png24" src="images/24bit.png" width="50" height="50">

Or if you are programmatically creating images:

var img = document.createElement('img');
img.src = 'images/24bit.png';
img.width = 50;
img.height = 50;
img.className = 'png24';
document.getElementsByTagName('BODY')[0].appendChild(img);

The important things to do are:

1. you need an 8 bit transparent image to use with the hack, first  
line of the applyPNGFilter function.  It can be png or gif.  Either  
will work.

2. You MUST give an explicit width and height to your images, either  
inline or via CSS or via javascript, otherwise nothing will show up.

3. You CANNOT change the src of an image via javascript because it  
has already been changed to images/a_pixel.png and the actual src  
moved to a filter.  You must modify the filter instead.  For  
instance, this block could be used to swap an image source (for a  
mouse-over effect, for instance) using 24 bit images.

if (img.style.runtimeStyle) {
     img.style.runtimeStyle.filter =  
"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+url 
+"',sizingMethod='scale')";
} else {
     img.src = url;
}


On 7-Sep-06, at 8:41 AM, Kenneth, GEOGRAF A/S wrote:

> I know that it is possible to display alphablended images in IE,  
> because it is used in ea. google calendar for shadows.
> Maybe the MapGuide team knows this, as they've made selections/ 
> buffers work with alpha blending?
>
> Kenneth, GEOGRAF A/S
>
> Tom Chadwin skrev:
>> Thanks for the advice, Kenneth. We are required by our base  
>> mapping suppliers to overprint a licence agreement on maps, say,  
>> along the bottom edge. They also require us to watermark maps with  
>> our logo. This is what I am trying to achieve. An absolutely  
>> positioned DIV could probably do the former, though it would be  
>> nice to give the text a semi-transparent white background so that  
>> it was more legible over the map. PNGs could do this, as well as  
>> the watermark logo, but I believe PNG alpha transparency is not  
>> supported in IE6. Any further ideas on how I should proceed?  
>> Thanks again Tom Tom Chadwin e-Enablement & Web Development  
>> Officer Telephone: 01434 611530 Mobile: Fax: 01434 611677 Email:  
>> tom.chadwin at nnpa.org.uk Web : www.Northumberland-national- 
>> park.org.uk <http://www.Northumberland-national-park.org.uk>  
>> <http://www.northumberland-national-park.org.uk/>  
>> _____________________________________________________________________ 
>> _______ IMPORTANT NOTICE - Disclaimer - September 7, 2006 - REF  
>> Email-200609-00020552. If you have received this e-mail in error  
>> or wish to read our e-mail disclaimer statement and monitoring  
>> policy, please refer to the statement below or contact the sender.  
>> This communication is from Northumberland National Park Authority  
>> (NNPA).The Authority's head office and principal place of business  
>> is Eastburn, South Park, Hexham, Northumberland, NE46 1BS, United  
>> Kingdom.This communication and any attachments contain information  
>> which is confidential and may also be privileged. It is for the  
>> exclusive use of users at mapguide.osgeo.org. If you are not the  
>> intended recipient(s) please note that any form of disclosure,  
>> distribution, copying or use of this communication or the  
>> information in it or in any attachments is strictly prohibited and  
>> may be unlawful. If you have received this communication in error,  
>> please return it with the title "received in error" to  
>> "it.security at nnpa.org.uk" then delete the email and destroy any  
>> copies of it. E-mail communications cannot be guaranteed to be  
>> secure or error free, as information could be intercepted,  
>> corrupted, amended, lost, destroyed, arrive late or incomplete, or  
>> contain viruses. We do not accept liability for any such matters  
>> or their consequences. Anyone who communicates with us by e-mail  
>> is taken to accept the risks in doing so. Any views or opinions  
>> presented are solely those of the author and do not necessarily  
>> represent those of NNPA.Contractors or potential contractors are  
>> reminded that a formal Order or Contract is needed for NNPA to be  
>> bound by any offer or acceptance of terms for the supply of goods  
>> or services Although this email and any attachments are believed  
>> to be free of any virus or other defects which might affect any  
>> computer or IT system into which they are received, no  
>> responsibility is accepted by the NNPA for any loss or damage  
>> arising in any way from the receipt or use thereof. Computer  
>> systems of this Authority may be monitored and communications  
>> carried out on them recorded, to secure the effective operation of  
>> the system and for other lawful purposes. -----Original  
>> Message----- From: Kenneth, GEOGRAF A/S [mailto:ks at geograf.dk]  
>> Sent: 07 September 2006 11:28 To: users at mapguide.osgeo.org  
>> Subject: Re: FW: [mapguide-users] Watermarks and licence  
>> agreements [No Viruses detected] My first attempt would be to  
>> create a transparent image, and place it in the mapframe with  
>> absolute coordinates, and a high z-index, so that it will show all  
>> the time. If you are refering to "google-like" watermarking, I  
>> think you must hook into the imager render, and place the  
>> watermark algorithm there. I don't know how you want to display  
>> the license statement, is it a kind of EULA the user must accept  
>> before displaying the map? Kenneth, GEOGRAF A/S Tom Chadwin skrev:
>>> Hello all Can anyone help me with the query I submitted to this  
>>> list a few weeks
>>> ago? Many thanks Tom Tom Chadwin e-Enablement & Web Development  
>>> Officer Telephone: 01434 611530 Mobile: Fax: 01434 611677 Email:  
>>> tom.chadwin at nnpa.org.uk Web : www.Northumberland-national- 
>>> park.org.uk <http://www.Northumberland-national-park.org.uk>  
>>> <http://www.northumberland-national-park.org.uk/>  
>>> ____________________________________________________________________ 
>>> __ ______ IMPORTANT NOTICE - Disclaimer - September 7, 2006 - REF  
>>> Email-200609-00020478. If you have received this e-mail in error  
>>> or wish to read our e-mail
>> disclaimer statement and monitoring policy, please refer to the  
>> statement below or contact the sender.
>>> This communication is from Northumberland National Park Authority
>> (NNPA).The Authority's head office and principal place of business  
>> is Eastburn, South Park, Hexham, Northumberland, NE46 1BS, United  
>> Kingdom.This communication and any attachments contain information  
>> which is confidential and may also be privileged. It is for the  
>> exclusive use of users at mapguide.osgeo.org. If you are not the  
>> intended recipient(s) please note that any form of disclosure,  
>> distribution, copying or use of this communication or the  
>> information in it or in any attachments is strictly prohibited and  
>> may be unlawful. If you have received this communication in error,  
>> please return it with the title "received in error" to  
>> "it.security at nnpa.org.uk" then delete the email and destroy any  
>> copies of it.
>>> E-mail communications cannot be guaranteed to be secure or error  
>>> free,
>> as information could be intercepted, corrupted, amended, lost,  
>> destroyed, arrive late or incomplete, or contain viruses. We do  
>> not accept liability for any such matters or their consequences.  
>> Anyone who communicates with us by e-mail is taken to accept the  
>> risks in doing so.
>>> Any views or opinions presented are solely those of the author  
>>> and do
>> not necessarily represent those of NNPA.Contractors or potential  
>> contractors are reminded that a formal Order or Contract is needed  
>> for NNPA to be bound by any offer or acceptance of terms for the  
>> supply of goods or services Although this email and any  
>> attachments are believed to be free of any virus or other defects  
>> which might affect any computer or IT system into which they are  
>> received, no responsibility is accepted by the NNPA for any loss  
>> or damage arising in any way from the receipt or use thereof.  
>> Computer systems of this Authority may be monitored and  
>> communications carried out on them recorded, to secure the  
>> effective operation of the system and for other lawful purposes.
>>> -----Original Message----- From: Tom Chadwin  
>>> [mailto:tom.chadwin at nnpa.org.uk] Sent: 14 July 2006 10:58 To:  
>>> users at mapguide.osgeo.org Subject: [mapguide-users] Watermarks and  
>>> licence agreements [No Viruses detected] Hello all I'm new to  
>>> MapGuide OS, and have started to put a site together. Can anyone  
>>> tell me how I can put a watermark of our logo over the map  
>>> output? Also, our licence agreement for our base mapping means  
>>> that we
>>> have to overlay a licence statement. Is this also possible? Many  
>>> thanks Tom Chadwin  
>>> -------------------------------------------------------------------- 
>>> - To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org  
>>> For additional commands, e-mail: users-help at mapguide.osgeo.org
>> --------------------------------------------------------------------- 
>>  To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org For  
>> additional commands, e-mail: users-help at mapguide.osgeo.org  
>> --------------------------------------------------------------------- 
>>  To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org For  
>> additional commands, e-mail: users-help at mapguide.osgeo.org

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+








More information about the Mapguide-users mailing list