[Xweb-developers] preserve ratio in imageCopy
Brought to you by:
peterbecker
|
From: Ralf P. <ra...@pu...> - 2004-01-12 08:06:40
|
Hi,
creating thumbnails width the imageCopy-docstyle is a cool feature,
which could save me a lot of time. But for my galleries i need to
scale images with (max)height and (max)width where the width/height-
ratio should be kept:
<documentStyle type="image.thumb">
<imageCopy width="135" height="135"/>
</documentStyle>
The code for scaling would be the following (ImageCopyDocType.java:113):
} else if (this.width != -1 && this.height != -1) {
lastWidth = oldWidth;
lastHeight = oldHeight;
if (lastWidth > width) {
lastHeight = (lastHeight * width) / lastWidth;
lastWidth = width;
}
if (lastHeight > height) {
lastWidth = (lastWidth * height) / lastHeight;
lastHeight = height;
}
}
Would iit be possible, to integrate this feature into XWeb?
Another possible solution would be adding new maxHeight and maxWidth
attributes to the imageCopy tag.
Regards,
Ralf
|