1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Converted image-manager to be component/HTML based

Instead of vue based.
This commit is contained in:
Dan Brown
2020-07-25 00:20:58 +01:00
parent b6aa232205
commit 02dc3154e3
23 changed files with 483 additions and 392 deletions

View File

@ -185,7 +185,7 @@ class ImageRepo
* Load thumbnails onto an image object.
* @throws Exception
*/
protected function loadThumbs(Image $image)
public function loadThumbs(Image $image)
{
$image->thumbs = [
'gallery' => $this->getThumbnail($image, 150, 150, false),
@ -219,4 +219,20 @@ class ImageRepo
return null;
}
}
/**
* Get the user visible pages using the given image.
*/
public function getPagesUsingImage(Image $image): array
{
$pages = Page::visible()
->where('html', 'like', '%' . $image->url . '%')
->get(['id', 'name', 'slug', 'book_id']);
foreach ($pages as $page) {
$page->url = $page->getUrl();
}
return $pages->all();
}
}