Update VideoThumbnail job, remove outdated cloud storage logic

This commit is contained in:
Daniel Supernault 2021-01-19 19:42:31 -07:00
parent 4a70e18596
commit 2284d85f9c
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -62,24 +62,6 @@ class VideoThumbnail implements ShouldQueue
}
if(config('pixelfed.cloud_storage') == true) {
$path = storage_path('app/'.$media->media_path);
$thumb = storage_path('app/'.$media->thumbnail_path);
$p = explode('/', $media->media_path);
$monthHash = $p[2];
$userHash = $p[3];
$storagePath = "public/m/{$monthHash}/{$userHash}";
$file = Storage::disk(config('filesystems.cloud'))->putFile($storagePath, new File($path), 'public');
$url = Storage::disk(config('filesystems.cloud'))->url($file);
$thumbFile = Storage::disk(config('filesystems.cloud'))->putFile($storagePath, new File($thumb), 'public');
$thumbUrl = Storage::disk(config('filesystems.cloud'))->url($thumbFile);
$media->thumbnail_url = $thumbUrl;
$media->cdn_url = $url;
$media->optimized_url = $url;
$media->save();
}
if($media->status_id) {
Cache::forget('status:transformer:media:attachments:' . $media->status_id);
}