- Introduced `ocrSpace` module with classes: `ocr_space`, `ocrSpace_c`, and configuration objects for `enabled` and `api_key`. - Added routes for fetching and updating OCR Space configuration. - Created `image_processor` class and interface for handling and processing base64-encoded images. - Integrated new traits and classes for image validation and processing. - Updated `index.php` to include `ocr_space` and `image_processor`.
34 lines
633 B
PHP
34 lines
633 B
PHP
<?php
|
|
|
|
namespace classes;
|
|
require_once WD . '/modules/ocrSpace/ocrSpace_c.php';
|
|
|
|
use Exception;
|
|
use interfaces\ocr_space_i;
|
|
use ocrSpace\ocrSpace_c;
|
|
|
|
class ocr_space implements ocr_space_i
|
|
{
|
|
/**
|
|
* The configuration of the module
|
|
* @var ocrSpace_c
|
|
*/
|
|
public ocrSpace_c $config;
|
|
|
|
|
|
public function __construct()
|
|
{
|
|
$this->config = new ocrSpace_c();
|
|
}
|
|
|
|
|
|
/**
|
|
* @inheritDoc
|
|
*/
|
|
public function requireModuleEnabled(): void
|
|
{
|
|
if (!(bool)$this->config->enabled->getVariableValue()) {
|
|
throw new Exception('OCR Space module is not enabled.');
|
|
}
|
|
}
|
|
} |