1
0
Fork 1
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:
Daniel Supernault 2020-12-05 00:18:34 -07:00
parent 9404a36c66
commit 473e049528
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -182,6 +182,10 @@ class Image
$media->save(); $media->save();
if($thumbnail) {
$this->generateBlurhash($media);
}
Cache::forget('status:transformer:media:attachments:'.$media->status_id); Cache::forget('status:transformer:media:attachments:'.$media->status_id);
Cache::forget('status:thumb:'.$media->status_id); Cache::forget('status:thumb:'.$media->status_id);
} catch (Exception $e) { } catch (Exception $e) {
@ -198,4 +202,13 @@ class Image
return ['path' => $basePath, 'png' => $png]; return ['path' => $basePath, 'png' => $png];
} }
protected function generateBlurhash($media)
{
$blurhash = Blurhash::generate($media);
if($blurhash) {
$media->blurhash = $blurhash;
$media->save();
}
}
} }