summaryrefslogtreecommitdiff
path: root/inc/media.php
diff options
context:
space:
mode:
authorAdrian Lang <mail@adrianlang.de>2011-09-22 21:37:33 +0200
committerAdrian Lang <mail@adrianlang.de>2011-09-22 21:58:12 +0200
commit33e91473c28e8f1c8542459bb4d755beb620305e (patch)
tree46ea7f4935055369253ede9633ad21790e2db721 /inc/media.php
parentf0aec085b4f30f98db19b1e59400356013f14c4e (diff)
downloadrpg-33e91473c28e8f1c8542459bb4d755beb620305e.tar.gz
rpg-33e91473c28e8f1c8542459bb4d755beb620305e.tar.bz2
Resize images in fullscreen mediamanager using CSS
Diffstat (limited to 'inc/media.php')
-rw-r--r--inc/media.php58
1 files changed, 27 insertions, 31 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">';