1
0
Fork 1
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:
Daniel Supernault 2021-01-24 21:07:28 -07:00
parent f930c4bda2
commit ce6ab80dba
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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);
}
}