Admin
in package
Admin service for all photo admin related functions.
Table of Contents
Properties
- $aclService : AclService
- $metadataService : Metadata
- $photoMapper : Photo
- $photoService : Photo
- $storageService : FileStorage
- $translator : Translator
Methods
- __construct() : mixed
- checkUploadAllowed() : void
- Checks if the current user is allowed to upload photos.
- storeUploadedPhoto() : bool|Photo
- Move the uploaded photo to the storage and store it in the database.
- upload() : void
- createThumbnail() : string
- Creates and stores a thumbnail of specified maximum size from a stored image.
Properties
$aclService read-only
private
AclService
$aclService
$metadataService read-only
private
Metadata
$metadataService
$photoMapper read-only
private
Photo
$photoMapper
$photoService read-only
private
Photo
$photoService
$storageService read-only
private
FileStorage
$storageService
$translator read-only
private
Translator
$translator
Methods
__construct()
public
__construct(AclService $aclService, Translator $translator, Photo $photoService, Metadata $metadataService, FileStorage $storageService, Photo $photoMapper) : mixed
Parameters
- $aclService : AclService
- $translator : Translator
- $photoService : Photo
- $metadataService : Metadata
- $storageService : FileStorage
- $photoMapper : Photo
checkUploadAllowed()
Checks if the current user is allowed to upload photos.
public
checkUploadAllowed() : void
storeUploadedPhoto()
Move the uploaded photo to the storage and store it in the database.
public
storeUploadedPhoto(string $path, Album $targetAlbum[, bool $move = false ]) : bool|Photo
All upload actions should use this function to prevent "ghost" files or database entries.
Parameters
- $path : string
-
the temporary path of the uploaded photo
- $targetAlbum : Album
-
the album to save the photo in
- $move : bool = false
-
whether to move the photo instead of copying it
Return values
bool|Photoupload()
public
upload(array<string|int, mixed> $files, Album $album) : void
Parameters
- $files : array<string|int, mixed>
- $album : Album
Tags
createThumbnail()
Creates and stores a thumbnail of specified maximum size from a stored image.
protected
createThumbnail(string $path, int $width, int $height) : string
Parameters
- $path : string
-
the path of the original image
- $width : int
-
the maximum width of the thumbnail (in px)
- $height : int
-
the maximum height of the thumbnail (in px)
Return values
string —the path of the created thumbnail