PHP Class BookStack\Repos\ImageRepo

Show file Open project: ssddanbrown/bookstack

Protected Properties

Property Type Description
$image
$imageService
$page
$restrictionService

Public Methods

Method Description
__construct ( Image $image, ImageService $imageService, PermissionService $permissionService, Page $page ) ImageRepo constructor.
destroyImage ( Image $image ) : boolean Destroys an Image object along with its files and thumbnails.
getById ( $id ) : mixed Get an image with the given id.
getGalleryFiltered ( integer $pagination, integer $pageSize = 24, $filter, $pageId ) : array Get gallery images with a particular filter criteria such as being within the current book or page.
getPaginatedByType ( string $type, integer $page, integer $pageSize = 24, boolean | integer $userFilter = false ) : array Gets a load images paginated, filtered by image type.
getThumbnail ( Image $image, integer $width = 220, integer $height = 220, boolean $keepRatio = false ) : string Get the thumbnail for an image.
saveNew ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadFile, string $type, integer $uploadedTo ) : Image Save a new image into storage and return the new image.
searchPaginatedByType ( string $type, integer $page, integer $pageSize = 24, string $searchTerm ) : array Search for images by query, of a particular type.
updateImageDetails ( Image $image, array $updateDetails ) : Image Update the details of an image via an array of properties.

Private Methods

Method Description
loadThumbs ( Image $image ) Load thumbnails onto an image object.
returnPaginated ( $query, integer $page, integer $pageSize = 24 ) : array Execute a paginated query, returning in a standard format.

Method Details

__construct() public method

ImageRepo constructor.
public __construct ( Image $image, ImageService $imageService, PermissionService $permissionService, Page $page )
$image BookStack\Image
$imageService BookStack\Services\ImageService
$permissionService BookStack\Services\PermissionService
$page BookStack\Page

destroyImage() public method

Destroys an Image object along with its files and thumbnails.
public destroyImage ( Image $image ) : boolean
$image BookStack\Image
return boolean

getById() public method

Get an image with the given id.
public getById ( $id ) : mixed
$id
return mixed

getGalleryFiltered() public method

Get gallery images with a particular filter criteria such as being within the current book or page.
public getGalleryFiltered ( integer $pagination, integer $pageSize = 24, $filter, $pageId ) : array
$pagination integer
$pageSize integer
$filter
$pageId
return array

getPaginatedByType() public method

Gets a load images paginated, filtered by image type.
public getPaginatedByType ( string $type, integer $page, integer $pageSize = 24, boolean | integer $userFilter = false ) : array
$type string
$page integer
$pageSize integer
$userFilter boolean | integer
return array

getThumbnail() public method

If $keepRatio is true only the width will be used. Checks the cache then storage to avoid creating / accessing the filesystem on every check.
public getThumbnail ( Image $image, integer $width = 220, integer $height = 220, boolean $keepRatio = false ) : string
$image BookStack\Image
$width integer
$height integer
$keepRatio boolean
return string

saveNew() public method

Save a new image into storage and return the new image.
public saveNew ( Symfony\Component\HttpFoundation\File\UploadedFile $uploadFile, string $type, integer $uploadedTo ) : Image
$uploadFile Symfony\Component\HttpFoundation\File\UploadedFile
$type string
$uploadedTo integer
return BookStack\Image

searchPaginatedByType() public method

Search for images by query, of a particular type.
public searchPaginatedByType ( string $type, integer $page, integer $pageSize = 24, string $searchTerm ) : array
$type string
$page integer
$pageSize integer
$searchTerm string
return array

updateImageDetails() public method

Update the details of an image via an array of properties.
public updateImageDetails ( Image $image, array $updateDetails ) : Image
$image BookStack\Image
$updateDetails array
return BookStack\Image

Property Details

$image protected property

protected $image

$imageService protected property

protected $imageService

$page protected property

protected $page

$restrictionService protected property

protected $restrictionService