A "universal downloader" that pulls images from external sources into the project's S3 buckets. It ensures images are valid and resized before storage.
- Trigger: Receives messages from SQS.
- Download: Pulls the image from the provided
accessURIusingaxios. - Validation: Checks the image magic bytes to ensure it's a supported type (JPG, PNG).
- Processing: Uses the
sharplibrary to resize the image (default max 1500x1500px) and converts it to high-quality JPEG. - Upload: Saves the processed image to S3.
- For
ocrtasks: Includes metadata (queue-id, file-id, etc.) in the S3 object which triggers the next step in the pipeline.
- For
- Callback:
- For
exporttasks: Sends a success status to the Laravel app via SQS. - For
ocrtasks: Remains silent if successful (S3 event trigger handles the OCR start), but reports failures.
- For
- Inputs (JSON):
taskType: Eitherexportorocr.accessURI: Source URL of the image.s3Bucket/s3Path: Destination in S3.updatesQueueUrl: SQS URL for status reporting.maxWidth/maxHeight: (Optional) Custom resizing constraints.
- Outputs:
- S3: Processed JPEG image at
s3Path. - SQS: Success/Failure notification to
updatesQueueUrl.
- S3: Processed JPEG image at
JPEG_QUALITY: The quality level for the output JPEG (Default:80).
- Laravel Job:
App\Jobs\ZooniverseExportImageUpdateJob(Processes fetcher updates for exports).