]> git.mxchange.org Git - friendica.git/blobdiff - src/Model/Photo.php
Changed to null-coalscing style (??) as sugguested by @MrPetovan
[friendica.git] / src / Model / Photo.php
index 8583577890aa898424ae107ff44a90585028be85..d9e6f7cadebb8c54688cce3f531d15d5e025da54 100644 (file)
@@ -704,10 +704,19 @@ class Photo
                }
                $image_uri = substr($image_uri, strrpos($image_uri, '/') + 1);
                $image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
-               if (!strlen($image_uri)) {
-                       return '';
-               }
-               return $image_uri;
+               return trim($image_uri);
+       }
+
+       /**
+        * Checks if the given URL is a local photo.
+        * Since it is meant for time critical occasions, the check is done without any database requests.
+        *
+        * @param string $url
+        * @return boolean
+        */
+       public static function isPhotoURI(string $url): bool
+       {
+               return !empty(self::ridFromURI($url));
        }
 
        /**