Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test functions

initFacialRecognition()

Parameters

This function accepts no parameters.

Location

include/facial_recognition_functions.php lines 11 to 65

Definition

 
function initFacialRecognition()
    {
    global 
$facial_recognition_tag_field$facial_recognition_face_recognizer_models_location$annotate_enabled,
           
$annotate_fields;

    if (!
is_numeric($facial_recognition_tag_field) || >= $facial_recognition_tag_field) {
        return 
false;
    }

    if (!
is_dir($facial_recognition_face_recognizer_models_location)) {
        if (
strpos($facial_recognition_face_recognizer_models_location$GLOBALS["storagedir"]) === 0) {
            
// Create the directory as it is in the configured filestore
            
mkdir($facial_recognition_face_recognizer_models_location0777true);
        } else {
            
// Folder needs to be created by server admin
            
$error str_replace(
                [
"%variable","%path"],
                [
"\$facial_recognition_face_recognizer_models_location"$facial_recognition_face_recognizer_models_location],
                
$GLOBALS["lang"]["error_invalid_path"]
            );
            if (
PHP_SAPI == "cli") {
                echo 
$error PHP_EOL;
            } else {
                
debug($error);
            }
            return 
false;
        }
    }

    
$facial_recognition_rtf_type ps_value(
        
"SELECT `type` AS `value`
           FROM resource_type_field
          WHERE ref = ?
        "
,array("i",$facial_recognition_tag_field),
        
null"schema");

    if (
FIELD_TYPE_DYNAMIC_KEYWORDS_LIST != $facial_recognition_rtf_type) {
        
$error str_replace(
            [
"%variable","%type"],
            [
"\$facial_recognition_tag_field"$GLOBALS["lang"]["fieldtype-dynamic_keywords_list"]],
            
$GLOBALS["lang"]["error_invalid_field_type"]
        );
        if (
PHP_SAPI == "cli") {
            echo 
$error PHP_EOL;
        } else {
            
debug($error);
        }
        return 
false;
    }

    
$annotate_enabled true;
    
$annotate_fields[] = $facial_recognition_tag_field;

    return 
true;
    }

This article was last updated 4th December 2024 08:35 Europe/London time based on the source file dated 19th September 2024 17:30 Europe/London time.