mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-25 01:05:36 +00:00
Update media pipeline, add blurhash support
This commit is contained in:
parent
9404a36c66
commit
473e049528
1 changed files with 13 additions and 0 deletions
|
@ -182,6 +182,10 @@ class Image
|
|||
|
||||
|
||||
$media->save();
|
||||
|
||||
if($thumbnail) {
|
||||
$this->generateBlurhash($media);
|
||||
}
|
||||
Cache::forget('status:transformer:media:attachments:'.$media->status_id);
|
||||
Cache::forget('status:thumb:'.$media->status_id);
|
||||
} catch (Exception $e) {
|
||||
|
@ -198,4 +202,13 @@ class Image
|
|||
|
||||
return ['path' => $basePath, 'png' => $png];
|
||||
}
|
||||
|
||||
protected function generateBlurhash($media)
|
||||
{
|
||||
$blurhash = Blurhash::generate($media);
|
||||
if($blurhash) {
|
||||
$media->blurhash = $blurhash;
|
||||
$media->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue