✨ Ajoute la gallerie

On utilise une libraire pour créer les miniatures
Fix #4
This commit is contained in:
Shikiryu committed 2020-03-10 13:10:38 +01:00
1 parent 99ec67affb
commit 7cec21bc21
10 files changed
+432 -20

No files matched your search

-16
View File
@@ -42,20 +42,4 @@ class User extends Authenticatable
$arrayHash = str_split(strtolower(md5($this->id)));
return sprintf('%s/%s', $arrayHash[0], $arrayHash[1]);
}
public function getImageData(Post $post)
{
if (empty($post->image)) {
return '';
}
$path = sprintf('%s/%s/%s', storage_path('app'), $this->getFolder(), $post->image);
if (!is_readable($path)) {
return '';
}
$type = pathinfo($path, PATHINFO_EXTENSION);
$data = file_get_contents($path);
return sprintf('data:image/%s;base64,%s', $type, base64_encode($data));
}
}