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

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
News Flash: Adobe Has iPhone Workaround
Adobe's Flash 10.1 Goes Mobile (Minus iPhone)
A Salute to Visionary CEOs

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, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Shopping | E-mail Offers | Freelance Jobs

webref The latest from WebReference.com Browse >
Building a Banking Application Home Page with OOP · Mixing Scripting Languages · Review: phpFox, a Social Networking CMS with all the Bells and Whistles
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
Enterprise 2.0: Social Networking in the Cloud · BroadSoft Marketplace Hastens Pace of Telephony Innovation · Review: HTC Hero for Sprint