Commit 1553fb57 authored by Son Nguyen's avatar Son Nguyen Committed by Gerrit Code Review
Browse files

Merge "Getting the max height from the img files correctly (Bug #1266586)" into 1.9_STABLE

parents cc6b4fb2 d1d51498
......@@ -368,14 +368,19 @@ class PluginBlocktypeGallery extends PluginBlocktype {
// If the Thumbnails are Square or not...
if ($style == 2) {
$src .= '&size=' . $width . 'x' . $width;
$height = $width;
}
else {
$src .= '&maxwidth=' . $width;
$imgwidth = $image->get('width');
$imgheight = $image->get('height');
$height = ($imgwidth > $width) ? intval(($width / $imgwidth) * $imgheight) : $imgheight;
}
$images[] = array(
'link' => $link,
'source' => $src,
'height' => $height,
'title' => $image->get('description'),
'slimbox2' => $slimbox2attr
);
......
......@@ -14,7 +14,11 @@ $j(function() {
if ($j('#thumbnails{$instanceid}')) {
// adjust height of image + description box to align things up
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());
$j('#thumbnails{$instanceid} .thumb').each(function() {
$j(this).css('height', maxHeight);
......
......@@ -2,7 +2,7 @@
{foreach from=$images item=image}
<div style="float:left;{if $frame} padding: 3px;{/if}" class="thumb">
<a rel="{$image.slimbox2}" href="{$image.link}" title="{$image.title}" target="_blank">
<img src="{$image.source}" alt="{$image.title}" title="{$image.title}" {if $frame}class="frame"{/if} />
<img src="{$image.source}" {if $image.height}height="{$image.height}"{/if} alt="{$image.title}" title="{$image.title}" {if $frame}class="frame"{/if} />
</a>
{if $showdescription && $image.title}<div class="caption" style="width: {$captionwidth}px;">{$image.title|safe}</div>{/if}
</div>
......@@ -14,7 +14,11 @@ $j(function() {
if ($j('#thumbnails{$instanceid}')) {
// adjust height of image + description box to align things up
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());
$j('#thumbnails{$instanceid} .thumb').each(function() {
$j(this).css('height', maxHeight);
......
Markdown is supported
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