X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/56264551e7a616c363ce817513d216f967abba43..refs/pull/711/head:/app/Repos/ImageRepo.php diff --git a/app/Repos/ImageRepo.php b/app/Repos/ImageRepo.php index 97839c27f..ec2fda1d3 100644 --- a/app/Repos/ImageRepo.php +++ b/app/Repos/ImageRepo.php @@ -1,12 +1,9 @@ image->where('type', '=', strtolower($type))->where('name', 'LIKE', '%' . $searchTerm . '%'); return $this->returnPaginated($images, $page, $pageSize); @@ -104,13 +101,13 @@ class ImageRepo /** * Get gallery images with a particular filter criteria such as * being within the current book or page. - * @param int $pagination - * @param int $pageSize * @param $filter * @param $pageId + * @param int $pageNum + * @param int $pageSize * @return array */ - public function getGalleryFiltered($pagination = 0, $pageSize = 24, $filter, $pageId) + public function getGalleryFiltered($filter, $pageId, $pageNum = 0, $pageSize = 24) { $images = $this->image->where('type', '=', 'gallery'); @@ -123,7 +120,7 @@ class ImageRepo $images = $images->whereIn('uploaded_to', $validPageIds); } - return $this->returnPaginated($images, $pagination, $pageSize); + return $this->returnPaginated($images, $pageNum, $pageSize); } /** @@ -247,5 +244,14 @@ class ImageRepo } } - -} \ No newline at end of file + /** + * Check if the provided image type is valid. + * @param $type + * @return bool + */ + public function isValidType($type) + { + $validTypes = ['drawing', 'gallery', 'cover', 'system', 'user']; + return in_array($type, $validTypes); + } +}