Documentation

AlbumCover
in package

Album cover services. Used for (re)generating album covers.

Table of Contents

Properties

$photoConfig  : array<string|int, mixed>
$photoMapper  : Photo
$storage  : FileStorage
$storageConfig  : array<string|int, mixed>

Methods

__construct()  : mixed
createCover()  : string|null
Creates, stores and returns the path to a cover image, a mosaic generated from a random selection of photos in the album or sub-albums.
drawComposition()  : void
Draws the mosaic of photos.
generateCover()  : Imagick|null
Creates a cover image for the given album.
getImages()  : array<string|int, Imagick>
Returns the images needed to fill the album cover.
getLayerWithPhotos()  : array<string|int, Album>
resizeCropImage()  : Imagick
Specialized function to resize and crop photos such that they always fill the full width and height without damaging the aspect ratio of the photo.

Properties

$photoConfig read-only

private array<string|int, mixed> $photoConfig

$storageConfig read-only

private array<string|int, mixed> $storageConfig

Methods

__construct()

public __construct(Photo $photoMapper, FileStorage $storage, array<string|int, mixed> $photoConfig, array<string|int, mixed> $storageConfig) : mixed
Parameters
$photoMapper : Photo
$storage : FileStorage
$photoConfig : array<string|int, mixed>
$storageConfig : array<string|int, mixed>
Tags
phpcsSuppress

SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingTraversableTypeHintSpecification

createCover()

Creates, stores and returns the path to a cover image, a mosaic generated from a random selection of photos in the album or sub-albums.

public createCover(Album $album) : string|null
Parameters
$album : Album

the album to create the cover for

Return values
string|null

the path to the cover image

drawComposition()

Draws the mosaic of photos.

protected drawComposition(Imagick $target, int $columns, int $rows, array<string|int, Imagick$images) : void
Parameters
$target : Imagick

the target object to draw to

$columns : int

The amount of columns to fill

$rows : int

The amount of rows to fill

$images : array<string|int, Imagick>

to fill the mosaic with

generateCover()

Creates a cover image for the given album.

protected generateCover(Album $album) : Imagick|null
Parameters
$album : Album

the album to create a cover image for

Return values
Imagick|null

the cover image or null if one could not be created

getImages()

Returns the images needed to fill the album cover.

protected getImages(Album $album, int $count[, int $maxDepth = 3 ]) : array<string|int, Imagick>
Parameters
$album : Album
$count : int

the amount of images needed

$maxDepth : int = 3
Return values
array<string|int, Imagick>

of Imagick - a list of the images

getLayerWithPhotos()

protected getLayerWithPhotos(array<string|int, Album$subAlbums, int $maxDepth) : array<string|int, Album>
Parameters
$subAlbums : array<string|int, Album>
$maxDepth : int
Return values
array<string|int, Album>

resizeCropImage()

Specialized function to resize and crop photos such that they always fill the full width and height without damaging the aspect ratio of the photo.

protected resizeCropImage(Imagick $image, int $width, int $height) : Imagick
Parameters
$image : Imagick

The Imagick object to be resized and cropped

$width : int

The desired width

$height : int

The desired height

Return values
Imagick

$image


        
On this page

Search results