mirror of
https://github.com/friendica/friendica
synced 2025-04-29 09:04:24 +02:00
Rename Photo::newResource() result variable from $hash to $resource_id
This commit is contained in:
parent
03bf1dcbd3
commit
26b5de9a76
5 changed files with 41 additions and 41 deletions
|
@ -404,9 +404,9 @@ class Photo extends BaseObject
|
|||
"photo", ["resource-id"], ["uid" => $uid, "contact-id" => $cid, "scale" => 4, "album" => "Contact Photos"]
|
||||
);
|
||||
if (!empty($photo['resource-id'])) {
|
||||
$hash = $photo["resource-id"];
|
||||
$resource_id = $photo["resource-id"];
|
||||
} else {
|
||||
$hash = self::newResource();
|
||||
$resource_id = self::newResource();
|
||||
}
|
||||
|
||||
$photo_failure = false;
|
||||
|
@ -432,7 +432,7 @@ class Photo extends BaseObject
|
|||
if ($Image->isValid()) {
|
||||
$Image->scaleToSquare(300);
|
||||
|
||||
$r = self::store($Image, $uid, $cid, $hash, $filename, "Contact Photos", 4);
|
||||
$r = self::store($Image, $uid, $cid, $resource_id, $filename, "Contact Photos", 4);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -440,7 +440,7 @@ class Photo extends BaseObject
|
|||
|
||||
$Image->scaleDown(80);
|
||||
|
||||
$r = self::store($Image, $uid, $cid, $hash, $filename, "Contact Photos", 5);
|
||||
$r = self::store($Image, $uid, $cid, $resource_id, $filename, "Contact Photos", 5);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -448,7 +448,7 @@ class Photo extends BaseObject
|
|||
|
||||
$Image->scaleDown(48);
|
||||
|
||||
$r = self::store($Image, $uid, $cid, $hash, $filename, "Contact Photos", 6);
|
||||
$r = self::store($Image, $uid, $cid, $resource_id, $filename, "Contact Photos", 6);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -456,24 +456,24 @@ class Photo extends BaseObject
|
|||
|
||||
$suffix = "?ts=" . time();
|
||||
|
||||
$image_url = System::baseUrl() . "/photo/" . $hash . "-4." . $Image->getExt() . $suffix;
|
||||
$thumb = System::baseUrl() . "/photo/" . $hash . "-5." . $Image->getExt() . $suffix;
|
||||
$micro = System::baseUrl() . "/photo/" . $hash . "-6." . $Image->getExt() . $suffix;
|
||||
$image_url = System::baseUrl() . "/photo/" . $resource_id . "-4." . $Image->getExt() . $suffix;
|
||||
$thumb = System::baseUrl() . "/photo/" . $resource_id . "-5." . $Image->getExt() . $suffix;
|
||||
$micro = System::baseUrl() . "/photo/" . $resource_id . "-6." . $Image->getExt() . $suffix;
|
||||
|
||||
// Remove the cached photo
|
||||
$a = \get_app();
|
||||
$basepath = $a->getBasePath();
|
||||
|
||||
if (is_dir($basepath . "/photo")) {
|
||||
$filename = $basepath . "/photo/" . $hash . "-4." . $Image->getExt();
|
||||
$filename = $basepath . "/photo/" . $resource_id . "-4." . $Image->getExt();
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
$filename = $basepath . "/photo/" . $hash . "-5." . $Image->getExt();
|
||||
$filename = $basepath . "/photo/" . $resource_id . "-5." . $Image->getExt();
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
$filename = $basepath . "/photo/" . $hash . "-6." . $Image->getExt();
|
||||
$filename = $basepath . "/photo/" . $resource_id . "-6." . $Image->getExt();
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
|
|
|
@ -836,9 +836,9 @@ class User
|
|||
if ($Image->isValid()) {
|
||||
$Image->scaleToSquare(300);
|
||||
|
||||
$hash = Photo::newResource();
|
||||
$resource_id = Photo::newResource();
|
||||
|
||||
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 4);
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, L10n::t('Profile Photos'), 4);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -846,7 +846,7 @@ class User
|
|||
|
||||
$Image->scaleDown(80);
|
||||
|
||||
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 5);
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, L10n::t('Profile Photos'), 5);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -854,14 +854,14 @@ class User
|
|||
|
||||
$Image->scaleDown(48);
|
||||
|
||||
$r = Photo::store($Image, $uid, 0, $hash, $filename, L10n::t('Profile Photos'), 6);
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, L10n::t('Profile Photos'), 6);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
}
|
||||
|
||||
if (!$photo_failure) {
|
||||
Photo::update(['profile' => 1], ['resource-id' => $hash]);
|
||||
Photo::update(['profile' => 1], ['resource-id' => $resource_id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue