]> source.dussan.org Git - nextcloud-server.git/commitdiff
we don't have empty previewstacks any more - code cleaned up
authorStephan Bergemann <st.bergemann@htw-berlin.de>
Thu, 14 Jun 2012 10:39:18 +0000 (12:39 +0200)
committerStephan Bergemann <st.bergemann@htw-berlin.de>
Thu, 14 Jun 2012 10:39:18 +0000 (12:39 +0200)
apps/gallery/lib/tiles.php

index 817939759d01c0c40e61afe031cb66e299c5cdfa..2ff4fa5647b7a46240fc5a76cfa25ea6ae6a63e6 100644 (file)
@@ -134,47 +134,32 @@ class TileStack extends TileBase {
 
        public function getWidth() {
                $max = 0;
-               if(count($this->tiles_array) == 0) {
-                       $max = IMAGE_WIDTH;
-               } else {
-                       for ($i = 0; $i < count($this->tiles_array); $i++) {
-                               $max = max($max, $this->tiles_array[$i]->getWidth());
-                       }
+               for ($i = 0; $i < count($this->tiles_array); $i++) {
+                       $max = max($max, $this->tiles_array[$i]->getWidth());
                }
                return min(IMAGE_WIDTH, $max);
        }
 
        public function get() {
                $r = '<div class="title gallery_div">'.$this->stack_name.'</div>';
-               if(count($this->tiles_array) == 0) {
-                       // aint no pictures in this folder...
-                       $r.='<div class="miniature_border gallery_div"></div>';
-               } else {
-                       for ($i = 0; $i < count($this->tiles_array); $i++) {
-                               $top = rand(-5, 5);
-                               $left = rand(-5, 5);
-                               $img_w = $this->tiles_array[$i]->getWidth();
-                               $extra = '';
-                               if ($img_w < IMAGE_WIDTH) {
-                                       $extra = 'width:'.$img_w.'px;';
-                               }
-                               $r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>';
+               for ($i = 0; $i < count($this->tiles_array); $i++) {
+                       $top = rand(-5, 5);
+                       $left = rand(-5, 5);
+                       $img_w = $this->tiles_array[$i]->getWidth();
+                       $extra = '';
+                       if ($img_w < IMAGE_WIDTH) {
+                               $extra = 'width:'.$img_w.'px;';
                        }
+                       $r .= '<div class="miniature_border gallery_div" style="background-image:url(\''.$this->tiles_array[$i]->getMiniatureSrc().'\');margin-top:'.$top.'px; margin-left:'.$left.'px;'.$extra.'"></div>';
                }
                return $r;
        }
 
        public function getOnHoverAction() {
-               if(count($this->tiles_array) == 0) {
-                       return 'javascript:explode_empty(this);return false;';
-               }
                return 'javascript:explode(this);return false;';
        }
        
        public function getOnOutAction() {
-               if(count($this->tiles_array) == 0) {
-                       return 'javascript:deplode_empty(this);return false;';
-               }
                return 'javascript:deplode(this);return false;';
        }