1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-28 17:02:04 +03:00

Fixed shelf covers being stored as 'cover_book'

Are now stored as 'cover_bookshelf' as expected.
Added a migrate to alter existing shelf cover image types.
This commit is contained in:
Dan Brown
2022-09-02 12:54:54 +01:00
parent 27ac122502
commit f28ed0ef0b
4 changed files with 46 additions and 2 deletions

View File

@ -86,8 +86,9 @@ class BaseRepo
public function updateCoverImage($entity, ?UploadedFile $coverImage, bool $removeImage = false)
{
if ($coverImage) {
$imageType = $entity->coverImageTypeKey();
$this->imageRepo->destroyImage($entity->cover);
$image = $this->imageRepo->saveNew($coverImage, 'cover_book', $entity->id, 512, 512, true);
$image = $this->imageRepo->saveNew($coverImage, $imageType, $entity->id, 512, 512, true);
$entity->cover()->associate($image);
$entity->save();
}