Commit eaf104d8 authored by Robert Lyon's avatar Robert Lyon
Browse files

Getting the max height from the img files correctly (Bug #1266586)



Problem existed where the cache didn't know the height of the files as
they had not been loaded before so the getting of the hightest one was
failing.

Changed it so that mahara passes in the height of the file to allow it
to fetch that instead.

Change-Id: I0a2cd8d316544cce65da73c1a7787759d5d6706d
Signed-off-by: Robert Lyon's avatarRobert Lyon <robertl@catalyst.net.nz>
parent 2a1b9c77
...@@ -14,7 +14,11 @@ $j(function() { ...@@ -14,7 +14,11 @@ $j(function() {
if ($j('#thumbnails{$instanceid}')) { if ($j('#thumbnails{$instanceid}')) {
// adjust height of image + description box to align things up // adjust height of image + description box to align things up
var maxHeight = Math.max.apply(null, $j('#thumbnails{$instanceid} .thumb').map(function() { var maxHeight = Math.max.apply(null, $j('#thumbnails{$instanceid} .thumb').map(function() {
return $j(this).height(); var height = parseInt($j(this).find('img').attr('height'));
if ($j(this).find('.caption').length > 0) {
height += parseInt($j(this).find('.caption').height());
}
return (height + 3); // we will give it a little more heigth to avoid a vertical scrollbar sometimes appearing
}).get()); }).get());
$j('#thumbnails{$instanceid} .thumb').each(function() { $j('#thumbnails{$instanceid} .thumb').each(function() {
$j(this).css('height', maxHeight); $j(this).css('height', maxHeight);
......
...@@ -14,7 +14,11 @@ $j(function() { ...@@ -14,7 +14,11 @@ $j(function() {
if ($j('#thumbnails{$instanceid}')) { if ($j('#thumbnails{$instanceid}')) {
// adjust height of image + description box to align things up // adjust height of image + description box to align things up
var maxHeight = Math.max.apply(null, $j('#thumbnails{$instanceid} .thumb').map(function() { var maxHeight = Math.max.apply(null, $j('#thumbnails{$instanceid} .thumb').map(function() {
return $j(this).height(); var height = parseInt($j(this).find('img').attr('height'));
if ($j(this).find('.caption').length > 0) {
height += parseInt($j(this).find('.caption').height());
}
return (height + 3); // we will give it a little more heigth to avoid a vertical scrollbar sometimes appearing
}).get()); }).get());
$j('#thumbnails{$instanceid} .thumb').each(function() { $j('#thumbnails{$instanceid} .thumb').each(function() {
$j(this).css('height', maxHeight); $j(this).css('height', maxHeight);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment