diff options
author | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-01-21 02:26:39 +0400 |
---|---|---|
committer | Bartek Przybylski <bart.p.pl@gmail.com> | 2012-01-21 02:28:40 +0400 |
commit | 437d50c6f6ec5eebf8424e37f4052f90646869c5 (patch) | |
tree | 2d4e543c22a5777d60ea5d98b7bcb6251d8049f2 /apps | |
parent | 97901391f473fdb546cce5294530a307bb1d803c (diff) |
recognizing img basing on extension
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gallery/lib/hooks_handlers.php | 6 | ||||
-rw-r--r-- | apps/gallery/lib/scanner.php | 5 |
2 files changed, 4 insertions, 7 deletions
diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 7248e67f0a2..53a924ff40a 100644 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -32,10 +32,8 @@ class OC_Gallery_Hooks_Handlers { private static $APP_TAG = "Gallery"; private static function isPhoto($filename) { - OC_Log::write(self::$APP_TAG, "Checking file ".$filename." with mimetype ".OC_Filesystem::getMimeType($filename), OC_Log::DEBUG); - if (substr(OC_Filesystem::getMimeType($filename), 0, 6) == "image/") - return true; - return false; + $ext = strtolower(substr($filename, strrpos($filename, '.')+1)); + return $ext=='png' || $ext=='jpeg' || $ext=='jpg' || $ext=='gif'; } private static function directoryContainsPhotos($dirpath) { diff --git a/apps/gallery/lib/scanner.php b/apps/gallery/lib/scanner.php index df33369b93b..447174e84c0 100644 --- a/apps/gallery/lib/scanner.php +++ b/apps/gallery/lib/scanner.php @@ -88,9 +88,8 @@ class OC_Gallery_Scanner { } public static function isPhoto($filename) { - if (substr(OC_Filesystem::getMimeType($filename), 0, 6) == "image/") - return 1; - return 0; + $ext = strtolower(substr($filename, strrpos($filename, '.')+1)); + return $ext=='png' || $ext=='jpeg' || $ext=='jpg' || $ext=='gif'; } public static function find_paths($path) { |