+ return $this->returnPaginated($images, $page, $pageSize);
+ }
+
+ /**
+ * Search for images by query, of a particular type.
+ * @param string $type
+ * @param int $page
+ * @param int $pageSize
+ * @param string $searchTerm
+ * @return array
+ */
+ public function searchPaginatedByType($type, $searchTerm, $page = 0, $pageSize = 24)
+ {
+ $images = $this->image->where('type', '=', strtolower($type))->where('name', 'LIKE', '%' . $searchTerm . '%');
+ return $this->returnPaginated($images, $page, $pageSize);
+ }
+
+ /**
+ * Get gallery images with a particular filter criteria such as
+ * being within the current book or page.
+ * @param $filter
+ * @param $pageId
+ * @param int $pageNum
+ * @param int $pageSize
+ * @return array
+ */
+ public function getGalleryFiltered($filter, $pageId, $pageNum = 0, $pageSize = 24)
+ {
+ $images = $this->image->where('type', '=', 'gallery');