Tiger_Media_Scanner_Rekognition
@api· implementsTiger_Media_Scanner_Interface
Tiger_Media_Scanner_Rekognition — AI content moderation via AWS Rekognition.
IMAGES (synchronous): DetectModerationLabels on the bytes; any label at/above the
confidence threshold rejects the upload. VIDEOS (asynchronous): StartContentModeration
against an S3 object returns a JobId and publishes the result to an SNS topic — an
SNS→webhook (Media_CallbackController) flips the media row from in_review when it lands
(see MEDIA.md §4).
Needs aws/aws-sdk-php + credentials (instance role). Absent the SDK this degrades to an
error result (the feature is config-gated off by default anyway).
Methods
__construct()
__construct(float $threshold = 80.0, string $region = 'us-east-1')
Configure the moderation threshold and AWS region.
$thresholdfloat— minimum label confidence (percent) that rejects an image$regionstring— the AWS region for the Rekognition client
scan()
scan(string $path, ?string $mime = null): array
Moderate an image synchronously via Rekognition DetectModerationLabels.
$pathstring— the image on disk to moderate$mime?string— the file's MIME type (unused; part of the scanner contract)
Returns array — reason:?string, meta:array}
submitVideo()
submitVideo(string $bucket, string $key, string $snsTopicArn, string $roleArn): ?string
Submit a stored S3 VIDEO for async moderation. Returns the Rekognition JobId (kept in the media row's scan_meta so the webhook can match the result), or null on failure.
TODO(P4/P5): wire once S3 storage + the SNS topic/role are provisioned — needs media.scan.video_sns_topic + media.scan.video_role and the S3 disk.
$bucketstring— the S3 bucket holding the stored video$keystring— the S3 object key of the video$snsTopicArnstring— the SNS topic ARN Rekognition publishes the result to$roleArnstring— the IAM role ARN Rekognition assumes to publish
Returns ?string — the Rekognition JobId, or null on failure