From 33e91473c28e8f1c8542459bb4d755beb620305e Mon Sep 17 00:00:00 2001 From: Adrian Lang Date: Thu, 22 Sep 2011 21:37:33 +0200 Subject: Resize images in fullscreen mediamanager using CSS --- inc/media.php | 58 +++++++++++++++++++--------------------- 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 ''; - echo ''; - echo ''; - } + // output + if ($fullscreen) { + echo ''; + echo ''; + echo ''; } - if ($fullscreen) return ''; + if ($fullscreen) return; echo '
'; echo '
'; 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 { -- cgit v1.2.3