Ajoute la gallerie

On utilise une libraire pour créer les miniatures
Fix #4
This commit is contained in:
2020-03-10 13:09:05 +01:00
parent 99ec67affb
commit 7cec21bc21
10 changed files with 432 additions and 20 deletions

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));
}
}