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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Microsoft Shows Off Silverlight 4, IE9 Plans
Metasploit Expands Vulnerability Test Framework
HyperCard Reborn?

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:

internet.commediabistro.comJusttechjobs.comGraphics.com

Search:

WebMediaBrands Corporate Info

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Rolling Out Your Own HTML Application Version Control · HTML 5: Client-side Storage · Working with Ajax Server Extensions
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Wi-Fi Product Watch, November 2009 · Chip Market Recovering From '08 Collapse · Low-Cost Tools to Kickstart Your New Business