mirror of
https://github.com/YunoHost-Apps/pixelfed_ynh.git
synced 2024-09-03 20:06:04 +02:00
Update MediaStorageService, improve support for pleroma .blob avatars
This commit is contained in:
parent
aaed2bf66e
commit
66226658db
1 changed files with 10 additions and 0 deletions
|
@ -203,6 +203,7 @@ class MediaStorageService {
|
||||||
}
|
}
|
||||||
|
|
||||||
$mimes = [
|
$mimes = [
|
||||||
|
'application/octet-stream',
|
||||||
'image/jpeg',
|
'image/jpeg',
|
||||||
'image/png',
|
'image/png',
|
||||||
];
|
];
|
||||||
|
@ -239,6 +240,15 @@ class MediaStorageService {
|
||||||
}
|
}
|
||||||
file_put_contents($tmpName, $data);
|
file_put_contents($tmpName, $data);
|
||||||
|
|
||||||
|
$mimeCheck = Storage::mimeType('remcache/' . $tmpPath);
|
||||||
|
|
||||||
|
if(!$mimeCheck || !in_array($mimeCheck, ['image/png', 'image/jpeg'])) {
|
||||||
|
$avatar->last_fetched_at = now();
|
||||||
|
$avatar->save();
|
||||||
|
unlink($tmpName);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$disk = Storage::disk($driver);
|
$disk = Storage::disk($driver);
|
||||||
$file = $disk->putFileAs($base, new File($tmpName), $path, 'public');
|
$file = $disk->putFileAs($base, new File($tmpName), $path, 'public');
|
||||||
$permalink = $disk->url($file);
|
$permalink = $disk->url($file);
|
||||||
|
|
Loading…
Add table
Reference in a new issue