diff options
Diffstat (limited to 'apps/gallery')
-rw-r--r-- | apps/gallery/ajax/galleryOp.php | 2 | ||||
-rw-r--r-- | apps/gallery/js/album_cover.js | 2 | ||||
-rw-r--r-- | apps/gallery/lib/scanner.php | 27 |
3 files changed, 13 insertions, 18 deletions
diff --git a/apps/gallery/ajax/galleryOp.php b/apps/gallery/ajax/galleryOp.php index f07814056a3..c19344c0fbb 100644 --- a/apps/gallery/ajax/galleryOp.php +++ b/apps/gallery/ajax/galleryOp.php @@ -62,7 +62,7 @@ function handleFilescan($cleanup) { function handlePartialCreate($path) { if (empty($path)) OC_JSON::error(array('cause' => 'No path specified')); - if (!OC_Filesystem::is_dir($path)) OC_JSON::error(array('cause' => 'Invalid path given')); + if (!OC_Filesystem::is_dir($path.'/')) OC_JSON::error(array('cause' => 'Invalid path given')); $album = OC_Gallery_Album::find(OC_User::getUser(), null, $path); $albums = array(); diff --git a/apps/gallery/js/album_cover.js b/apps/gallery/js/album_cover.js index 4ddac2f2111..d328a2d58e5 100644 --- a/apps/gallery/js/album_cover.js +++ b/apps/gallery/js/album_cover.js @@ -53,7 +53,7 @@ function scanForAlbums(cleanup) { } $('#scanprogressbar').progressbar({ value: (albumCounter/totalAlbums)*100 }).fadeIn(); for(var a in r.paths) { - $.getJSON('ajax/galleryOp.php?operation=partial_create&path='+r.paths[a], function(r) { + $.getJSON('ajax/galleryOp.php',{operation:'partial_create','path':r.paths[a]}, function(r) { if (r.status == 'success') { Albums.add(r.album_details.albumName, r.album_details.imagesCount); diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index 64efb006ad1..9c381acf389 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -53,7 +53,7 @@ class OC_Gallery_Scanner { $current_album = array('name'=> $path, 'imagesCount' => 0, 'images' => array()); $current_album['name'] = self::createName($current_album['name']); - if ($dh = OC_Filesystem::opendir($path)) { + if ($dh = OC_Filesystem::opendir($path.'/')) { while (($filename = readdir($dh)) !== false) { $filepath = ($path[strlen($path)-1]=='/'?$path:$path.'/').$filename; if (substr($filename, 0, 1) == '.') continue; @@ -103,21 +103,16 @@ class OC_Gallery_Scanner { } public static function find_paths($path) { - $ret = array(); - $dirres; - $addpath = FALSE; - if (($dirres = OC_Filesystem::opendir($path)) == FALSE) return $ret; - - while (($file = readdir($dirres)) != FALSE) { - if ($file[0] == '.') continue; - if (OC_Filesystem::is_dir($path.$file)) - $ret = array_merge($ret, self::find_paths($path.$file.'/')); - if (self::isPhoto($path.$file)) $addpath = TRUE; - } - - if ($addpath) $ret[] = urlencode($path); - - return $ret; + $images=OC_FileCache::searchByMime('image'); + $paths=array(); + foreach($images as $image){ + $path=dirname($image); + if(array_search($path,$paths)===false){ + error_log($path); + $paths[]=$path; + } + } + return $paths; } } ?> |