Photo
in package
Photo service.
Table of Contents
Properties
- $aclService : AclService
- $memberService : Member
- $photoConfig : array<string|int, mixed>
- $photoMapper : Photo
- $profilePhotoMapper : ProfilePhoto
- $storageService : FileStorage
- $tagMapper : Tag
- $translator : Translator
- $voteMapper : Vote
- $weeklyPhotoMapper : WeeklyPhoto
Methods
- __construct() : mixed
- addTag() : Tag|null
- Tags a user in the specified photo.
- countVote() : void
- Count a vote for the specified photo.
- deletePhoto() : bool
- Removes a photo from the database and deletes its files, including thumbs from the server.
- deletePhotoFile() : bool
- Deletes a stored photo at a given path.
- deletePhotoFiles() : void
- Deletes all files associated with a photo.
- determinePhotoOfTheWeek() : Photo|null
- Determine which photo is the photo of the week.
- findTag() : Tag|null
- Retrieves a tag if it exists.
- generatePhotoOfTheWeek() : WeeklyPhoto|null
- Generates the PhotoOfTheWeek and adds it to the list if at least one photo has been viewed in the specified time.
- getBaseDirectory() : string
- Gets the base directory from which the photo paths should be requested.
- getCurrentPhotoOfTheWeek() : WeeklyPhoto|null
- getPhoto() : Photo|null
- Retrieves a photo by an id.
- getPhotoDownload() : Stream|null
- Returns a Laminas response to be used for downloading a photo.
- getPhotoFileName() : string
- Returns a unique file name for a photo.
- getPhotos() : array<string|int, Photo>
- Get all photos in an album.
- getProfilePhoto() : Photo|null
- Determine which photo is best suited as profile picture.
- getTagsForMember() : array<string|int, Tag>
- Gets all photos in which a member has been tagged.
- hasExplicitProfilePhoto() : bool
- hasRecentVote() : bool
- Checks if the currently logged-in user has recently voted for a photo.
- hidePhotoOfTheWeek() : void
- Hide a Photo of the Week.
- isTaggedIn() : bool
- Checks whether a user is tagged in a photo.
- ratePhoto() : float|int
- Determine the preference rating of the photo.
- ratePhotoForMember() : float|int
- Determine the preference rating of the photo.
- removeProfilePhoto() : void
- removeTag() : bool
- Removes a tag.
- setProfilePhoto() : void
- cacheProfilePhoto() : void
- determineProfilePhoto() : Photo|null
- getStoredProfilePhoto() : ProfilePhoto|null
- Determine which photo is best suited as profile picture.
- storeProfilePhoto() : void
Properties
$aclService read-only
private
AclService
$aclService
$memberService read-only
private
Member
$memberService
$photoConfig read-only
private
array<string|int, mixed>
$photoConfig
$photoMapper read-only
private
Photo
$photoMapper
$profilePhotoMapper read-only
private
ProfilePhoto
$profilePhotoMapper
$storageService read-only
private
FileStorage
$storageService
$tagMapper read-only
private
Tag
$tagMapper
$translator read-only
private
Translator
$translator
$voteMapper read-only
private
Vote
$voteMapper
$weeklyPhotoMapper read-only
private
WeeklyPhoto
$weeklyPhotoMapper
Methods
__construct()
public
__construct(AclService $aclService, Translator $translator, Member $memberService, FileStorage $storageService, Photo $photoMapper, Tag $tagMapper, Vote $voteMapper, WeeklyPhoto $weeklyPhotoMapper, ProfilePhoto $profilePhotoMapper, array<string|int, mixed> $photoConfig) : mixed
Parameters
- $aclService : AclService
- $translator : Translator
- $memberService : Member
- $storageService : FileStorage
- $photoMapper : Photo
- $tagMapper : Tag
- $voteMapper : Vote
- $weeklyPhotoMapper : WeeklyPhoto
- $profilePhotoMapper : ProfilePhoto
- $photoConfig : array<string|int, mixed>
Tags
addTag()
Tags a user in the specified photo.
public
addTag(int $photoId, int $lidnr) : Tag|null
Parameters
- $photoId : int
- $lidnr : int
Tags
Return values
Tag|nullcountVote()
Count a vote for the specified photo.
public
countVote(int $photoId) : void
Parameters
- $photoId : int
Tags
deletePhoto()
Removes a photo from the database and deletes its files, including thumbs from the server.
public
deletePhoto(int $photoId) : bool
Parameters
- $photoId : int
-
the id of the photo to delete
Tags
Return values
bool —indicating whether the deletion was successful
deletePhotoFile()
Deletes a stored photo at a given path.
public
deletePhotoFile(string $path) : bool
Parameters
- $path : string
Return values
bool —indicated whether deleting the photo was successful
deletePhotoFiles()
Deletes all files associated with a photo.
public
deletePhotoFiles(Photo $photo) : void
Parameters
- $photo : Photo
determinePhotoOfTheWeek()
Determine which photo is the photo of the week.
public
determinePhotoOfTheWeek(DateTime $beginDate, DateTime $endDate) : Photo|null
Parameters
- $beginDate : DateTime
- $endDate : DateTime
Tags
Return values
Photo|nullfindTag()
Retrieves a tag if it exists.
public
findTag(int $photoId, int $lidnr) : Tag|null
Parameters
- $photoId : int
- $lidnr : int
Return values
Tag|nullgeneratePhotoOfTheWeek()
Generates the PhotoOfTheWeek and adds it to the list if at least one photo has been viewed in the specified time.
public
generatePhotoOfTheWeek([DateTime|null $beginDate = null ][, DateTime|null $endDate = null ]) : WeeklyPhoto|null
The parameters determine the week to check the photos of.
Parameters
- $beginDate : DateTime|null = null
- $endDate : DateTime|null = null
Tags
Return values
WeeklyPhoto|nullgetBaseDirectory()
Gets the base directory from which the photo paths should be requested.
public
getBaseDirectory() : string
Return values
stringgetCurrentPhotoOfTheWeek()
public
getCurrentPhotoOfTheWeek() : WeeklyPhoto|null
Return values
WeeklyPhoto|nullgetPhoto()
Retrieves a photo by an id.
public
getPhoto(int $id) : Photo|null
Parameters
- $id : int
-
the id of the album
Return values
Photo|null —photo matching the given id
getPhotoDownload()
Returns a Laminas response to be used for downloading a photo.
public
getPhotoDownload(int $photoId) : Stream|null
Parameters
- $photoId : int
Return values
Stream|nullgetPhotoFileName()
Returns a unique file name for a photo.
public
getPhotoFileName(Photo $photo) : string
Parameters
- $photo : Photo
-
the photo to get a name for
Return values
stringgetPhotos()
Get all photos in an album.
public
getPhotos(Album $album[, int $start = 0 ][, int|null $maxResults = null ]) : array<string|int, Photo>
Parameters
- $album : Album
-
the album to get the photos from
- $start : int = 0
-
the result to start at
- $maxResults : int|null = null
-
max amount of results to return, null for infinite
Return values
array<string|int, Photo>getProfilePhoto()
Determine which photo is best suited as profile picture.
public
getProfilePhoto(int $lidnr) : Photo|null
Parameters
- $lidnr : int
Tags
Return values
Photo|nullgetTagsForMember()
Gets all photos in which a member has been tagged.
public
getTagsForMember(Member $member) : array<string|int, Tag>
Parameters
- $member : Member
Return values
array<string|int, Tag>hasExplicitProfilePhoto()
public
hasExplicitProfilePhoto(int $lidnr) : bool
Parameters
- $lidnr : int
Tags
Return values
boolhasRecentVote()
Checks if the currently logged-in user has recently voted for a photo.
public
hasRecentVote() : bool
Return values
boolhidePhotoOfTheWeek()
Hide a Photo of the Week.
public
hidePhotoOfTheWeek(WeeklyPhoto $potw) : void
Parameters
- $potw : WeeklyPhoto
isTaggedIn()
Checks whether a user is tagged in a photo.
public
isTaggedIn(int $photoId, int $lidnr) : bool
Parameters
- $photoId : int
- $lidnr : int
Return values
boolratePhoto()
Determine the preference rating of the photo.
public
ratePhoto(Photo $photo, int $occurences) : float|int
Parameters
- $photo : Photo
- $occurences : int
Return values
float|intratePhotoForMember()
Determine the preference rating of the photo.
public
ratePhotoForMember(Photo $photo) : float|int
Parameters
- $photo : Photo
Return values
float|intremoveProfilePhoto()
public
removeProfilePhoto([ProfilePhoto|null $profilePhoto = null ]) : void
Parameters
- $profilePhoto : ProfilePhoto|null = null
Tags
removeTag()
Removes a tag.
public
removeTag(int $photoId, int $lidnr) : bool
Parameters
- $photoId : int
- $lidnr : int
Tags
Return values
bool —indicating whether removing the tag succeeded
setProfilePhoto()
public
setProfilePhoto(int $photoId) : void
Parameters
- $photoId : int
Tags
cacheProfilePhoto()
private
cacheProfilePhoto(int $lidnr, Photo $photo) : void
Parameters
- $lidnr : int
- $photo : Photo
Tags
determineProfilePhoto()
private
determineProfilePhoto(int $lidnr) : Photo|null
Parameters
- $lidnr : int
Tags
Return values
Photo|nullgetStoredProfilePhoto()
Determine which photo is best suited as profile picture.
private
getStoredProfilePhoto(int $lidnr) : ProfilePhoto|null
Parameters
- $lidnr : int
Tags
Return values
ProfilePhoto|nullstoreProfilePhoto()
private
storeProfilePhoto(Photo $photo, Member $member, DateTime $dateTime[, bool $explicit = false ]) : void