]> source.dussan.org Git - nextcloud-server.git/commitdiff
recognizing img basing on extension
authorBartek Przybylski <bart.p.pl@gmail.com>
Fri, 20 Jan 2012 22:26:39 +0000 (23:26 +0100)
committerBartek Przybylski <bart.p.pl@gmail.com>
Fri, 20 Jan 2012 22:28:40 +0000 (23:28 +0100)
apps/gallery/lib/hooks_handlers.php
apps/gallery/lib/scanner.php

index 7248e67f0a2cbe75b9aa62d4a0419a1225878573..53a924ff40abceef95488450da8e55b3604ce51a 100644 (file)
@@ -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) {
index df33369b93bcce02bc05ba865c6e9d50f7779805..447174e84c0f3dd41ec587e137c941cc809f6adf 100644 (file)
@@ -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) {