spacer
Yehuda Shiran October 14, 2000
Stretching and Cropping Images
Tips: October 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Eclipse Helios Update Brings New PHP Tools
Internet Explorer 9 Ups Standards Support
JBoss Portal 5 Release Easier to Use

The AlphaImageLoader filter has been introduced in IE 5.5. It supports two properties: sizingMethod and src. The sizingMethod property can take three values:

  • "image": Keep the original size of the image.
  • "scale": Stretch or compress the image to the container boundaries.
  • "crop": Crop the image to the container dimensions.

The src property denotes the image file being operated by the filter.

The following demo shows three buttons that you can operate for trying out these three sizingMethod's options.


















Here is the code:

<SCRIPT>
<!--
function fnChangeFilter(oButton, sizingOption) {
        oDiv.filters(0).sizingMethod=sizingOption;
}
// -->
</SCRIPT>
        
    
<DIV ID="oDiv" STYLE="position:absolute; left:140px; height:150; width:200;         
  filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(
  SRC='sunset.jpg', sizingMethod='scale');" >
</DIV>

<BUTTON onclick="fnChangeFilter(this, 'image');">Original</BUTTON><BR>
<BUTTON onclick="fnChangeFilter(this, 'scale');">Compress</BUTTON><BR>
<BUTTON onclick="fnChangeFilter(this, 'crop');">Crop</BUTTON>

Learn more about filters in Column 69, Introduction to Filters.


People who read this tip also read these tips:

Look for similar tips by subject:

webref The latest from WebReference.com Browse >
Flashmaps' DynamicLocator: Interactive Maps for Small Areas · Flashmaps' AreaSelector: Interactive Maps for Wide Areas · The DB Mapper: Interactive Street-level Maps of U.S. and Canada
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags