mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-23 08:14:10 +00:00
Update MediaStorageService, clear transformer cache after storing media
This commit is contained in:
parent
f930c4bda2
commit
ce6ab80dba
1 changed files with 21 additions and 2 deletions
|
@ -99,7 +99,23 @@ class MediaStorageService {
|
|||
return;
|
||||
}
|
||||
|
||||
$ext = $mime == 'image/jpeg' ? '.jpg' : ($mime == 'image/png' ? '.png' : 'mp4');
|
||||
switch ($mime) {
|
||||
case 'image/png':
|
||||
$ext = '.png';
|
||||
break;
|
||||
|
||||
case 'image/gif':
|
||||
$ext = '.gif';
|
||||
break;
|
||||
|
||||
case 'image/jpeg':
|
||||
$ext = '.jpg';
|
||||
break;
|
||||
|
||||
case 'video/mp4':
|
||||
$ext = '.mp4';
|
||||
break;
|
||||
}
|
||||
|
||||
$base = MediaPathService::get($media->profile);
|
||||
$path = Str::random(40) . $ext;
|
||||
|
@ -118,7 +134,10 @@ class MediaStorageService {
|
|||
$media->replicated_at = now();
|
||||
$media->save();
|
||||
|
||||
if($media->status_id) {
|
||||
Cache::forget('status:transformer:media:attachments:' . $media->status_id);
|
||||
}
|
||||
|
||||
unlink($tmpName);
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue