October 14, 2000 - Stretching and Cropping Images
October 14, 2000 Stretching and Cropping Images Tips: October 2000
Yehuda Shiran, Ph.D.
|
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.