mujma: BUGFIX: All image resolution should now work correctly.

(merged from branches/gsoc)


git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@41895 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2007-09-15 01:27:01 +00:00
parent f436292174
commit 88f0a3c0b1
1 changed files with 4 additions and 4 deletions

View File

@ -39,16 +39,16 @@ var ImageToResize = {
resizeOnFirstLoad: function() {
windowWidth = Element.getDimensions($('mainContainer')).width;
windowHeight = Element.getDimensions($('mainContainer')).height;
windowHeight = Element.getDimensions($('mainContainer')).height - 100;
imageWidth = Element.getDimensions(this.image).width;
imageHeight= Element.getDimensions(this.image).height;
if(imageWidth > windowWidth || imageHeight > windowHeight) {
if(imageWidth > windowWidth - 120 || imageHeight > windowHeight - 120) {
ratio = imageWidth / imageHeight;
if(imageWidth > imageHeight) {
newWidth = windowWidth - windowWidth/1.75;
newWidth = windowWidth - 120;
newHeight = newWidth * (1/ratio);
} else {
newHeight = windowHeight - windowHeight/1.75;
newHeight = windowHeight - 120;
newWidth = newHeight * ratio;
}
this.reportSize(0,0);