class Volume extends Model

A volume is a collection of images. Volumes belong to one or many projects.

Traits

Constants

FILE_REGEX

Regular expression that matches the supported image file extensions.

This regex allows optional HTTP query parameters after the file names, too. Example "image.jpg?raw=1". This may be required for remote images with services like Dropbox.

Properties

protected array $hidden The attributes hidden from the model's JSON form.
protected array $casts The attributes that should be casted to native types.
protected array $appends The accessors to append to the model's array form.

Methods

setJsonAttr(string $key, mixed $value, string $attrs = 'attrs')

Set a dynamic JSON attribute.

mixed
getJsonAttr(string $key, mixed $default = null, string $attrs = 'attrs')

Get a dynamic JSON attribute.

static array
parseImagesQueryString(string $string)

Parses a comma separated list of image filenames to an array.

Builder
scopeAccessibleBy(Builder $query, User $user)

Scope a query to all volumes that are accessible by a user.

BelongsTo
creator()

The user that created the volume.

BelongsTo
mediaType()

The media type of this volume.

void
setMediaType(MediaType $mediaType)

Sets the media type of this volume.

void
setMediaTypeId(int $id)

Sets the media type of this volume to the media type with the given ID.

HasMany
images()

The images belonging to this volume.

HasMany
orderedImages()

The images belonging to this volume ordered by filename (ascending).

Builder
users()

Return a query for all users associated to this volume through projects.

bool
createImages(array $filenames)

Creates the image objects to be associated with this volume.

handleNewImages(array $only = [])

Perform actions when new images were added to the volume.

BelongsToMany
projects()

The project(s), this volume belongs to.

HasMany
annotationSessions()

The annotation sessions of this volume.

HasOne
activeAnnotationSession()

The active annotation sessions of this volume (if any).

getActiveAnnotationSession(User $user)

Returns the active annotation session of this volume for the given user.

bool
hasConflictingAnnotationSession(AnnotationSession $session)

Check if the given annotation session is in conflict with existing ones.

bool
isRemote()

Check if the images of this volume come from a remote URL.

getThumbnailAttribute()

An image that can be used a unique thumbnail for this volume.

flushThumbnailCache()

Flush the cache that stores the volume thumbnail.

bool
hasGeoInfo()

Check if the volume has some images with GPS coordinates.

flushGeoInfoCache()

Flush the cached information if this volume has images with GPS coordinates.

setVideoLinkAttribute(string $value)

Set the video_link attribute of this volume.

string
getVideoLinkAttribute()

Get the video_link attribute of this volume.

setGisLinkAttribute(string $value)

Set the gis_link attribute of this volume.

string
getGisLinkAttribute()

Get the gis_link attribute of this volume.

setDoiAttribute(string $value)

Set the doi attribute of this volume.

string
getDoiAttribute()

Get the doi attribute of this volume.

bool
hasTiledImages()

Check if the there are tiled images in this volume.

Details

in HasJsonAttributes at line 14
protected setJsonAttr(string $key, mixed $value, string $attrs = 'attrs')

Set a dynamic JSON attribute.

Parameters

string $key Key of the attribute in the JSON.
mixed $value Value of the attribute in the JSON.
string $attrs Name of the JSON column of the model.

in HasJsonAttributes at line 36
protected mixed getJsonAttr(string $key, mixed $default = null, string $attrs = 'attrs')

Get a dynamic JSON attribute.

Parameters

string $key Key of the attribute in the JSON.
mixed $default Default value.
string $attrs Name of the JSON column of the model.

Return Value

mixed

at line 66
static array parseImagesQueryString(string $string)

Parses a comma separated list of image filenames to an array.

Parameters

string $string

Return Value

array

at line 79
Builder scopeAccessibleBy(Builder $query, User $user)

Scope a query to all volumes that are accessible by a user.

Parameters

Builder $query
User $user

Return Value

Builder

at line 99
BelongsTo creator()

The user that created the volume.

Return Value

BelongsTo

at line 109
BelongsTo mediaType()

The media type of this volume.

Return Value

BelongsTo

at line 120
void setMediaType(MediaType $mediaType)

Sets the media type of this volume.

Parameters

MediaType $mediaType

Return Value

void

at line 131
void setMediaTypeId(int $id)

Sets the media type of this volume to the media type with the given ID.

Parameters

int $id media type ID

Return Value

void

at line 145
HasMany images()

The images belonging to this volume.

Return Value

HasMany

at line 155
HasMany orderedImages()

The images belonging to this volume ordered by filename (ascending).

Return Value

HasMany

at line 165
Builder users()

Return a query for all users associated to this volume through projects.

Return Value

Builder

at line 192
bool createImages(array $filenames)

Creates the image objects to be associated with this volume.

Make sure the image filenames are valid.

Parameters

array $filenames image filenames at the location of the volume URL

Return Value

bool

Exceptions

QueryException If there was an error creating the images (e.g. if there were duplicate filenames).
UnsatisfiedDependencyException If the UUID generator cannot be executed for some reason.

at line 211
handleNewImages(array $only = [])

Perform actions when new images were added to the volume.

Parameters

array $only IDs of images to restrict the actions to.

at line 221
BelongsToMany projects()

The project(s), this volume belongs to.

Return Value

BelongsToMany

at line 231
HasMany annotationSessions()

The annotation sessions of this volume.

Return Value

HasMany

at line 241
HasOne activeAnnotationSession()

The active annotation sessions of this volume (if any).

Return Value

HasOne

at line 261
AnnotationSession getActiveAnnotationSession(User $user)

Returns the active annotation session of this volume for the given user.

An annotation session may be active for a volume but it is only also active for a user, if the user belongs to the set of restricted users of the annotation session.

Parameters

User $user

Return Value

AnnotationSession

at line 281
bool hasConflictingAnnotationSession(AnnotationSession $session)

Check if the given annotation session is in conflict with existing ones.

A conflict exists if the active time period of two sessions overlaps.

Parameters

AnnotationSession $session The annotation session to check

Return Value

bool

at line 310
bool isRemote()

Check if the images of this volume come from a remote URL.

Return Value

bool

at line 320
Image getThumbnailAttribute()

An image that can be used a unique thumbnail for this volume.

Return Value

Image

at line 334
flushThumbnailCache()

Flush the cache that stores the volume thumbnail.

at line 344
bool hasGeoInfo()

Check if the volume has some images with GPS coordinates.

Return Value

bool

at line 354
flushGeoInfoCache()

Flush the cached information if this volume has images with GPS coordinates.

at line 367
setVideoLinkAttribute(string $value)

Set the video_link attribute of this volume.

Parameters

string $value

at line 377
string getVideoLinkAttribute()

Get the video_link attribute of this volume.

Return Value

string

at line 387
setGisLinkAttribute(string $value)

Set the gis_link attribute of this volume.

Parameters

string $value

at line 397
string getGisLinkAttribute()

Get the gis_link attribute of this volume.

Return Value

string

at line 407
setDoiAttribute(string $value)

Set the doi attribute of this volume.

Parameters

string $value

at line 421
string getDoiAttribute()

Get the doi attribute of this volume.

Return Value

string

at line 431
bool hasTiledImages()

Check if the there are tiled images in this volume.

Return Value

bool