Files
api/services/nginx/app/interfaces/image_processor_i.php
T
Jeppe Bundgaard 69ceafcce6 Add OCR Space module with configuration and image processing support
- 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`.
2025-08-06 10:27:39 +02:00

38 lines
1.3 KiB
PHP

<?php
namespace interfaces;
use Exception;
use InvalidArgumentException;
use RuntimeException;
interface image_processor_i
{
/**
* Sets the image base64 string.
* @param string $base64 The base64 encoded image string.
* @return void
*/
public function set_image_base64(string $base64): void;
/**
* Gets the image base64 string.
* @return string The base64 encoded image string.
*/
function get_image_base64(): string;
/**
* Processes the image with the given parameters.
* @param array $params An associative array of parameters for processing the image.
* @return bool Returns true if the image was processed successfully, false otherwise.
* @note This method is abstract and must be implemented by the class that implements this interface.
* @throws Exception If the image processing fails.
* @throws InvalidArgumentException If the parameters are invalid.
* @throws RuntimeException If there is an error during processing.
*/
public function process_image(array $params): bool;
/**
* Gets the image format.
* @return string The format of the image (e.g., 'jpeg', 'png', 'gif').
* @throws RuntimeException If the image format cannot be determined.
*/
public function get_image_format(): string;
}