diff options
author | Adrian Lang <mail@adrianlang.de> | 2011-09-22 21:37:33 +0200 |
---|---|---|
committer | Adrian Lang <mail@adrianlang.de> | 2011-09-22 21:58:12 +0200 |
commit | 33e91473c28e8f1c8542459bb4d755beb620305e (patch) | |
tree | 46ea7f4935055369253ede9633ad21790e2db721 | |
parent | f0aec085b4f30f98db19b1e59400356013f14c4e (diff) | |
download | rpg-33e91473c28e8f1c8542459bb4d755beb620305e.tar.gz rpg-33e91473c28e8f1c8542459bb4d755beb620305e.tar.bz2 |
Resize images in fullscreen mediamanager using CSS
-rw-r--r-- | inc/media.php | 58 | ||||
-rw-r--r-- | lib/tpl/default/mediamanager.css | 12 |
2 files changed, 35 insertions, 35 deletions
diff --git a/inc/media.php b/inc/media.php index 560abc3bc..d26d18626 100644 --- a/inc/media.php +++ b/inc/media.php @@ -1441,42 +1441,38 @@ function media_printfile_thumbs($item,$auth,$jump=false,$display_namespace=false */ function media_printimgdetail($item, $fullscreen=false){ // prepare thumbnail - if (!$fullscreen) { - $size_array[] = 120; - } else { - $size_array = array(90, 40); - } - foreach ($size_array as $index => $size) { - $w = (int) $item['meta']->getField('File.Width'); - $h = (int) $item['meta']->getField('File.Height'); - if($w>$size || $h>$size){ - if (!$fullscreen) { - $ratio = $item['meta']->getResizeRatio($size); - } else { - $ratio = $item['meta']->getResizeRatio($size,$size); - } - $w = floor($w * $ratio); - $h = floor($h * $ratio); - } - $src = ml($item['id'],array('w'=>$w,'h'=>$h,'t'=>$item['mtime'])); - $p = array(); + $size = $fullscreen ? 90 : 120; + + $w = (int) $item['meta']->getField('File.Width'); + $h = (int) $item['meta']->getField('File.Height'); + if($w>$size || $h>$size){ if (!$fullscreen) { - $p['width'] = $w; - $p['height'] = $h; + $ratio = $item['meta']->getResizeRatio($size); + } else { + $ratio = $item['meta']->getResizeRatio($size,$size); } - $p['alt'] = $item['id']; - $att = buildAttributes($p); + $w = floor($w * $ratio); + $h = floor($h * $ratio); + } + $src = ml($item['id'],array('w'=>$w,'h'=>$h,'t'=>$item['mtime'])); + $p = array(); + if (!$fullscreen) { + // In fullscreen mediamanager view, image resizing is done via CSS. + $p['width'] = $w; + $p['height'] = $h; + } + $p['alt'] = $item['id']; + $att = buildAttributes($p); - // output - if ($fullscreen) { - echo '<a name="'.($index ? 'd' : 'l').'_:'.$item['id'].'" class="image '.($index ? 'tiny' : 'thumb').'" href="'. - media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')).'">'; - echo '<span><img src="'.$src.'" '.$att.' /></span>'; - echo '</a>'; - } + // output + if ($fullscreen) { + echo '<a name="l_:'.$item['id'].'" class="image thumb" href="'. + media_managerURL(array('image' => hsc($item['id']), 'ns' => getNS($item['id']), 'tab_details' => 'view')).'">'; + echo '<span><img src="'.$src.'" '.$att.' /></span>'; + echo '</a>'; } - if ($fullscreen) return ''; + if ($fullscreen) return; echo '<div class="detail">'; echo '<div class="thumb">'; diff --git a/lib/tpl/default/mediamanager.css b/lib/tpl/default/mediamanager.css index 9d2930af6..619ca9929 100644 --- a/lib/tpl/default/mediamanager.css +++ b/lib/tpl/default/mediamanager.css @@ -175,8 +175,10 @@ height: 90px; overflow: hidden; } -#mediamanager__page .filelist .thumbs li .tiny { - display: none; + +#mediamanager__page .filelist .thumbs li .thumb img { + max-width: 90px; + max-height: 90px; } #mediamanager__page .filelist .thumbs li .name, @@ -223,8 +225,10 @@ height: 40px; text-align: center; } -#mediamanager__page .filelist .rows li .thumb { - display: none; + +#mediamanager__page .filelist .rows li .thumb img { + max-width: 40px; + max-height: 40px; } #mediamanager__page .filelist .rows li .image span { |