Store ratio for determining stretch direction.

master
Jason A. Donenfeld 2011-07-11 15:28:18 -04:00
parent 725cb85cdb
commit 291dba972f
1 changed files with 2 additions and 2 deletions

View File

@ -146,7 +146,7 @@ $(document).ready(function() {
if (image.get(0) === this)
$(window).bind("resize", scaleImage);
container = $("#photo-view");
if (image.css("width") !== "100%" && container.height() * image.width() / image.height() > container.width())
if (image.css("width") !== "100%" && container.height() * image.attr("ratio") > container.width())
image.css("width", "100%").css("height", "auto").css("position", "absolute").css("bottom", 0);
else if (image.css("height") !== "100%")
image.css("height", "100%").css("width", "auto").css("position", "").css("bottom", "");
@ -166,7 +166,7 @@ $(document).ready(function() {
$(window).unbind("resize", scaleImage);
photoSrc = photoFloat.photoPath(currentAlbum, currentPhoto, maxSize, false);
$("#photo")
.attr("width", width).attr("height", height)
.attr("width", width).attr("height", height).attr("ratio", currentPhoto.size[0] / currentPhoto.size[1])
.attr("src", photoSrc)
.attr("alt", currentPhoto.name)
.attr("title", currentPhoto.date)