kopia lustrzana https://github.com/pixelfed/pixelfed
Update MediaStorageService, clear transformer cache after storing media
rodzic
f930c4bda2
commit
ce6ab80dba
|
@ -99,7 +99,23 @@ class MediaStorageService {
|
||||||
return;
|
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);
|
$base = MediaPathService::get($media->profile);
|
||||||
$path = Str::random(40) . $ext;
|
$path = Str::random(40) . $ext;
|
||||||
|
@ -118,7 +134,10 @@ class MediaStorageService {
|
||||||
$media->replicated_at = now();
|
$media->replicated_at = now();
|
||||||
$media->save();
|
$media->save();
|
||||||
|
|
||||||
|
if($media->status_id) {
|
||||||
|
Cache::forget('status:transformer:media:attachments:' . $media->status_id);
|
||||||
|
}
|
||||||
|
|
||||||
unlink($tmpName);
|
unlink($tmpName);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Ładowanie…
Reference in New Issue