X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FModel%2FPhoto.php;h=d9e6f7cadebb8c54688cce3f531d15d5e025da54;hb=624e4c192c7f837ac0587a50da6e1409081eb519;hp=8583577890aa898424ae107ff44a90585028be85;hpb=4eecf733e156eca7ea7cc4458b2daa8adda96209;p=friendica.git diff --git a/src/Model/Photo.php b/src/Model/Photo.php index 8583577890..d9e6f7cade 100644 --- a/src/Model/Photo.php +++ b/src/Model/Photo.php @@ -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)); } /**