mirror of
https://github.com/friendica/friendica
synced 2025-04-29 09:04:24 +02:00
Fix image links with descriptions in API and AP transmission
This commit is contained in:
parent
babcd24412
commit
1b5fa55bdc
3 changed files with 42 additions and 4 deletions
|
@ -715,4 +715,25 @@ class Photo extends BaseObject
|
|||
|
||||
return DBA::exists('photo', ['resource-id' => $guid]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests if the link points to a locally stored picture page
|
||||
*
|
||||
* @param string $name Page link
|
||||
* @return boolean
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function isLocalLink($name)
|
||||
{
|
||||
$a = \get_app();
|
||||
$base = $a->getBaseURL();
|
||||
|
||||
$guid = str_replace(Strings::normaliseLink($base), '', Strings::normaliseLink($name));
|
||||
$guid = preg_replace("=/photos/.*/image/(.*)=ism", '$1', $guid);
|
||||
if (empty($guid)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return DBA::exists('photo', ['resource-id' => $guid]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue