mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-26 00:03:16 +00:00
Update Avatar pipeline, fix cloud storage media_path
This commit is contained in:
parent
9a89a2b751
commit
02edd19d4d
3 changed files with 5 additions and 4 deletions
|
@ -196,8 +196,8 @@ class AvatarStorage extends Command
|
|||
continue;
|
||||
}
|
||||
$newMediaPath = $disk->put($newPath, $existing);
|
||||
$avatar->media_path = $newMediaPath;
|
||||
$avatar->cdn_url = $disk->url($newMediaPath);
|
||||
$avatar->media_path = $newPath;
|
||||
$avatar->cdn_url = $disk->url($newPath);
|
||||
$avatar->save();
|
||||
}
|
||||
|
||||
|
|
|
@ -93,8 +93,9 @@ class AvatarOptimize implements ShouldQueue
|
|||
$base = 'cache/avatars/' . $avatar->profile_id;
|
||||
$disk = Storage::disk(config('filesystems.cloud'));
|
||||
$disk->deleteDirectory($base);
|
||||
$path = $base . '/' . 'a' . strtolower(Str::random(random_int(3,6))) . $avatar->change_count . '.' . pathinfo($avatar->media_path, PATHINFO_EXTENSION);
|
||||
$path = $base . '/' . 'avatar_' . strtolower(Str::random(random_int(3,6))) . $avatar->change_count . '.' . pathinfo($avatar->media_path, PATHINFO_EXTENSION);
|
||||
$url = $disk->put($path, Storage::get($avatar->media_path));
|
||||
$avatar->media_path = $path;
|
||||
$avatar->cdn_url = $disk->url($path);
|
||||
$avatar->save();
|
||||
Storage::delete($avatar->media_path);
|
||||
|
|
|
@ -229,7 +229,7 @@ class MediaStorageService {
|
|||
|
||||
$base = ($local ? 'public/cache/' : 'cache/') . 'avatars/' . $avatar->profile_id;
|
||||
$ext = $head['mime'] == 'image/jpeg' ? 'jpg' : 'png';
|
||||
$path = Str::random(20) . '_avatar.' . $ext;
|
||||
$path = 'avatar_' . strtolower(Str::random(random_int(3,6))) . '.' . $ext;
|
||||
$tmpBase = storage_path('app/remcache/');
|
||||
$tmpPath = 'avatar_' . $avatar->profile_id . '-' . $path;
|
||||
$tmpName = $tmpBase . $tmpPath;
|
||||
|
|
Loading…
Reference in a new issue