Documentation

all.php

Table of Contents

Functions

HookFacesAllAddspecialsearch()  : PreparedStatementQuery|false
Hook that enables special search syntax to find resources with visually similar faces to a given resource.
HookFacesAllAfterpreviewcreation()  : void
Runs face detection and tagging automatically after preview creation, if configured.
HookFacesAllCron()  : void
Add face detection to the cron.
HookFacesAllAddtriggerablejob()  : array<string|int, mixed>
Hook into offline jobs list to add custom job

Functions

HookFacesAllAddspecialsearch()

Hook that enables special search syntax to find resources with visually similar faces to a given resource.

HookFacesAllAddspecialsearch(string $search, object $select, object $sql_join, object $sql_filter) : PreparedStatementQuery|false

This hook listens for the special search syntax !face<ID>, where <ID> is the ref of a face in the resource_face table. It queries an external Python service via HTTP to retrieve a list of resource references with matching faces above a configurable similarity threshold. The results are then integrated into ResourceSpace’s standard search mechanism.

Parameters
$search : string

The search string input, expected to be in the format '!face<ID>' if this is a search we're interested in.

$select : object

An object containing the SQL SELECT clause and its parameters.

$sql_join : object

An object containing any necessary SQL JOIN clauses and parameters.

$sql_filter : object

An object containing additional SQL filter conditions and parameters.

Tags
global

string $faces_service_endpoint Endpoint URL of the Python face recognition service.

float $faces_match_threshold Similarity threshold for face matches (default 0.3).

string $mysql_db Name of the current MySQL database (for namespacing service queries).

Return values
PreparedStatementQuery|false

Returns a prepared SQL query to fetch matching resources if the search matches the !face pattern; otherwise, returns false.

HookFacesAllAfterpreviewcreation()

Runs face detection and tagging automatically after preview creation, if configured.

HookFacesAllAfterpreviewcreation(int $resource, int $alternative[, bool $generate_all = false ]) : void

This function is triggered after a resource's preview image has been generated. If configured, it will perform face detection and/or tagging on the main resource file (ignoring alternative files). Progress messages are displayed during processing.

Parameters
$resource : int

The resource reference ID that has just had previews created.

$alternative : int

The alternative file ID, or -1 if processing the main resource.

$generate_all : bool = false

Flag to indicate if hook has been triggered during full preview creation process

HookFacesAllCron()

Add face detection to the cron.

HookFacesAllCron() : void

HookFacesAllAddtriggerablejob()

Hook into offline jobs list to add custom job

HookFacesAllAddtriggerablejob() : array<string|int, mixed>
Return values
array<string|int, mixed>

Array of existing job data with custom job added

On this page

Search results