From 437d50c6f6ec5eebf8424e37f4052f90646869c5 Mon Sep 17 00:00:00 2001 From: Bartek Przybylski Date: Fri, 20 Jan 2012 23:26:39 +0100 Subject: [PATCH] recognizing img basing on extension --- apps/gallery/lib/hooks_handlers.php | 6 ++---- 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) { -- 2.39.5