mirror of
https://github.com/friendica/friendica
synced 2025-04-28 03:50:17 +00:00
Use a constant for the profile photo album
This commit is contained in:
parent
f05fecaec1
commit
a33185f835
7 changed files with 17 additions and 53 deletions
|
@ -45,6 +45,7 @@ use Friendica\Util\Strings;
|
|||
class Photo
|
||||
{
|
||||
const CONTACT_PHOTOS = 'Contact Photos';
|
||||
const PROFILE_PHOTOS = 'Profile Photos';
|
||||
|
||||
const DEFAULT = 0;
|
||||
const USER_AVATAR = 10;
|
||||
|
@ -563,25 +564,6 @@ class Photo
|
|||
$image_url = DI::baseUrl() . "/photo/" . $resource_id . "-4." . $Image->getExt() . $suffix;
|
||||
$thumb = DI::baseUrl() . "/photo/" . $resource_id . "-5." . $Image->getExt() . $suffix;
|
||||
$micro = DI::baseUrl() . "/photo/" . $resource_id . "-6." . $Image->getExt() . $suffix;
|
||||
|
||||
// Remove the cached photo
|
||||
$a = DI::app();
|
||||
$basepath = $a->getBasePath();
|
||||
|
||||
if (is_dir($basepath . "/photo")) {
|
||||
$filename = $basepath . "/photo/" . $resource_id . "-4." . $Image->getExt();
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
$filename = $basepath . "/photo/" . $resource_id . "-5." . $Image->getExt();
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
$filename = $basepath . "/photo/" . $resource_id . "-6." . $Image->getExt();
|
||||
if (file_exists($filename)) {
|
||||
unlink($filename);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$photo_failure = true;
|
||||
}
|
||||
|
|
|
@ -1161,7 +1161,7 @@ class User
|
|||
|
||||
$resource_id = Photo::newResource();
|
||||
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 4);
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 4);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -1169,7 +1169,7 @@ class User
|
|||
|
||||
$Image->scaleDown(80);
|
||||
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 5);
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 5);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
@ -1177,7 +1177,7 @@ class User
|
|||
|
||||
$Image->scaleDown(48);
|
||||
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t('Profile Photos'), 6);
|
||||
$r = Photo::store($Image, $uid, 0, $resource_id, $filename, DI::l10n()->t(Photo::PROFILE_PHOTOS), 6);
|
||||
|
||||
if ($r === false) {
|
||||
$photo_failure = true;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue