mirror of
https://github.com/friendica/friendica
synced 2025-04-26 19:50:10 +00:00
Refactor duplicate code for parsing photo URL
This commit is contained in:
parent
a5895f8623
commit
95e65e37ee
2 changed files with 26 additions and 13 deletions
|
@ -215,12 +215,10 @@ class Mail
|
|||
$images = $match[1];
|
||||
if (count($images)) {
|
||||
foreach ($images as $image) {
|
||||
if (!stristr($image, DI::baseUrl() . '/photo/')) {
|
||||
continue;
|
||||
$image_rid = Photo::ridFromURI($image);
|
||||
if ($image_rid) {
|
||||
Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_rid, 'album' => 'Wall Photos', 'uid' => local_user()]);
|
||||
}
|
||||
$image_uri = substr($image, strrpos($image, '/') + 1);
|
||||
$image_uri = substr($image_uri, 0, strpos($image_uri, '-'));
|
||||
Photo::update(['allow-cid' => '<' . $recipient . '>'], ['resource-id' => $image_uri, 'album' => 'Wall Photos', 'uid' => local_user()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue